Skip to content

Introduction to Data Visualization with Seaborn

Run the hidden code cell below to import the data used in this course.


1 hidden cell

Take Notes

Add notes about the concepts you've learned and code cells with code you want to keep.

Styles

For changing the plot's style in seabor you can use "sns.set_style".

  • Available styles: "white", "dark", "whitegrid", "darkgrid" and "ticks"
  • white style is good when you want to show the overall trend
  • whitegrid is good when you want to focus on data

Palette

To change the pallette use "sns.set_palette()". There are divergig, sequential and custom palettes

  • Sequential palettes are goob for showing continues variables
  • you can create a custom pallete

Scales

You can modify figure´s scale to change how the plot is shown using "sns.set_context()" Scales from smallest to largest: "paper (default)", "notebook", "talk", "poste"

  • talk scale is good for presentations
# Add your code snippets here

Explore Datasets

Use the DataFrames imported in the first cell to explore the data and practice your skills!

  • From country_data, create a scatter plot to look at the relationship between GDP and Literacy. Use color to segment the data points by region.
  • Use mpg to create a line plot with model_year on the x-axis and weight on the y-axis. Create differentiating lines for each country of origin (origin).
  • Create a box plot from student_data to explore the relationship between the number of failures (failures) and the average final grade (G3).
  • Create a bar plot from survey to compare how Loneliness differs across values for Internet usage. Format it to have two subplots for gender.
  • Make sure to add titles and labels to your plots and adjust their format for readability!