|
| 1 | +INTERACTIVE COURSE |
| 2 | +Introduction to Data Visualization with Seaborn |
| 3 | +Introduction to Data Visualization with Seaborn |
| 4 | +4 hours |
| 5 | +14 Videos |
| 6 | +44 Exercises |
| 7 | +3,568 Participants |
| 8 | +3,700 XP |
| 9 | +This course is part of these tracks: |
| 10 | + |
| 11 | +Data Visualization with Python |
| 12 | +Erin Case |
| 13 | +Erin Case |
| 14 | +Data Scientist |
| 15 | + |
| 16 | +Erin is a Data Scientist who is passionate about both statistics and education. She enjoys experimental design, communicating data analyses to a wide range of audiences, and developing user-facing data products for technology companies. Previously, she was a biostatistician for two epidemiological studies on cardiac arrest. |
| 17 | + |
| 18 | +COLLABORATOR(S) |
| 19 | +Mona Khalil |
| 20 | +Mona Khalil |
| 21 | + |
| 22 | +Yashas Roy |
| 23 | +Yashas Roy |
| 24 | + |
| 25 | +PREREQUISITES |
| 26 | +Introduction to Data Science in Python |
| 27 | +DATASETS |
| 28 | +Countries |
| 29 | +Mileage per gallon |
| 30 | +Students |
| 31 | +Survey responses |
| 32 | +Course Description |
| 33 | +Seaborn is a powerful Python library that makes it easy to create informative and attractive visualizations. This course provides an introduction to Seaborn and teaches you how to visualize your data using plots such as scatter plots, box plots, and bar plots. You’ll do this while exploring survey responses about student hobbies and the factors that are associated with academic success. You’ll also learn about some of Seaborn’s advantages as a statistical visualization tool, such as how it automatically calculates confidence intervals. By the end of the course, you will be able to use Seaborn in a variety of situations to explore your data and effectively communicate the results of your data analyses to others. |
| 34 | + |
| 35 | + |
| 36 | +<=========================================================================================================================> |
| 37 | +1 |
| 38 | +Introduction to Seaborn |
| 39 | +FREE |
| 40 | +0% |
| 41 | +What is Seaborn, and when should you use it? In this chapter, you will find out! Plus, you will learn how to create scatter plots and count plots with both lists of data and pandas DataFrames. You will also be introduced to one of the big advantages of using Seaborn - the ability to easily add a third variable to your plots by using color to represent different subgroups. |
| 42 | + |
| 43 | + |
| 44 | +------------------------------------------------------------------------------------------------------------------------------ |
| 45 | + |
| 46 | + |
| 47 | +Making a scatter plot with lists |
| 48 | +In this exercise, we'll use a dataset that contains information about 227 countries. This dataset has lots of interesting information on each country, such as the country's birth rates, death rates, and its gross domestic product (GDP). GDP is the value of all the goods and services produced in a year, expressed as dollars per person. |
| 49 | + |
| 50 | +We've created three lists of data from this dataset to get you started. gdp is a list that contains the value of GDP per country, expressed as dollars per person. phones is a list of the number of mobile phones per 1,000 people in that country. Finally, percent_literate is a list that contains the percent of each country's population that can read and write. |
| 51 | + |
| 52 | +Instructions 1/4 |
| 53 | +25 XP |
| 54 | +1 |
| 55 | +2 |
| 56 | +3 |
| 57 | +4 |
| 58 | +Import Matplotlib and Seaborn using the standard naming convention. |
| 59 | +Take Hint (-7 XP) |
| 60 | + |
| 61 | +# Import Matplotlib and Seaborn |
| 62 | +import maplotlib.pyplot as plt |
| 63 | +import seaborn as sns |
| 64 | + |
| 65 | + |
| 66 | +Instructions 2/4 |
| 67 | +25 XP |
| 68 | +2 |
| 69 | +3 |
| 70 | +4 |
| 71 | +Create a scatter plot of GDP (gdp) vs. number of phones per 1000 people (phones). |
| 72 | + |
| 73 | + |
| 74 | +# Import Matplotlib and Seaborn |
| 75 | +import matplotlib.pyplot as plt |
| 76 | +import seaborn as sns |
| 77 | + |
| 78 | +# Create scatter plot with GDP on the x-axis and number of phones on the y-axis |
| 79 | +sns.scatterplot(x=gdp,y=phones) |
| 80 | + |
| 81 | +Instructions 3/4 |
| 82 | +25 XP |
| 83 | +3 |
| 84 | +4 |
| 85 | +Display the plot. |
| 86 | + |
| 87 | + |
| 88 | +# Import Matplotlib and Seaborn |
| 89 | +import matplotlib.pyplot as plt |
| 90 | +import seaborn as sns |
| 91 | + |
| 92 | +# Create scatter plot with GDP on the x-axis and number of phones on the y-axis |
| 93 | +sns.scatterplot(x=gdp, y=phones) |
| 94 | + |
| 95 | +# Show plot |
| 96 | +plt.show() |
| 97 | + |
| 98 | + |
| 99 | +Instructions 4/4 |
| 100 | +25 XP |
| 101 | +4 |
| 102 | +Change the scatter plot so it displays the percent of the population that can read and write (percent_literate) on the y-axis. |
| 103 | + |
| 104 | +# Import Matplotlib and Seaborn |
| 105 | +import matplotlib.pyplot as plt |
| 106 | +import seaborn as sns |
| 107 | + |
| 108 | +# Change this scatter plot to have percent literate on the y-axis |
| 109 | +sns.scatterplot(x=gdp, y=percent_literate) |
| 110 | + |
| 111 | +# Show plot |
| 112 | +plt.show() |
| 113 | + |
| 114 | + |
| 115 | + +100 XP |
| 116 | +Alright! While this plot does not show a linear relationship between GDP and percent literate, countries with a lower GDP do seem more likely to have a lower percent of the population that can read and write. |
| 117 | + |
| 118 | +-------------------------------------------------------------------------------------------------------------------------- |
| 119 | + |
| 120 | +Making a count plot with a list |
| 121 | +In the last exercise, we explored a dataset that contains information about 227 countries. Let's do more exploration of this data - specifically, how many countries are in each region of the world? |
| 122 | + |
| 123 | +To do this, we'll need to use a count plot. Count plots take in a categorical list and return bars that represent the number of list entries per category. You can create one here using a list of regions for each country, which is a variable named region. |
| 124 | + |
| 125 | +Instructions |
| 126 | +100 XP |
| 127 | +Import Matplotlib and Seaborn using the standard naming conventions. |
| 128 | +Use Seaborn to create a count plot with region on the y-axis. |
| 129 | +Display the plot. |
| 130 | + |
| 131 | + |
| 132 | +# Import Matplotlib and Seaborn |
| 133 | +import matplotlib.pyplot as plt |
| 134 | +import seaborn as sns |
| 135 | + |
| 136 | + |
| 137 | +# Create count plot with region on the y-axis |
| 138 | +sns.countplot(y=region) |
| 139 | + |
| 140 | +# Show plot |
| 141 | +plt.show() |
| 142 | + |
| 143 | + |
| 144 | + +100 XP |
| 145 | +Great job! Sub-Saharan Africa contains the most countries in this list. We'll revisit count plots later in the course. |
| 146 | +-------------------------------------------------------------------------------------------------------------------------- |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | +<=========================================================================================================================> |
| 155 | +VIEW CHAPTER DETAILS |
| 156 | +2 |
| 157 | +Visualizing Two Quantitative Variables |
| 158 | +0% |
| 159 | +In this chapter, you will create and customize plots that visualize the relationship between two quantitative variables. To do this, you will use scatter plots and line plots to explore how the level of air pollution in a city changes over the course of a day and how horsepower relates to fuel efficiency in cars. You will also see another big advantage of using Seaborn - the ability to easily create subplots in a single figure! |
| 160 | + |
| 161 | + |
| 162 | + |
| 163 | + |
| 164 | +<=========================================================================================================================> |
| 165 | +VIEW CHAPTER DETAILS |
| 166 | +3 |
| 167 | +Visualizing a Categorical and a Quantitative Variable |
| 168 | +0% |
| 169 | +Categorical variables are present in nearly every dataset, but they are especially prominent in survey data. In this chapter, you will learn how to create and customize categorical plots such as box plots, bar plots, count plots, and point plots. Along the way, you will explore survey data from young people about their interests, students about their study habits, and adult men about their feelings about masculinity. |
| 170 | + |
| 171 | + |
| 172 | + |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | +<=========================================================================================================================> |
| 177 | +VIEW CHAPTER DETAILS |
| 178 | +4 |
| 179 | +Customizing Seaborn Plots |
| 180 | +0% |
| 181 | +In this final chapter, you will learn how to add informative plot titles and axis labels, which are one of the most important parts of any data visualization! You will also learn how to customize the style of your visualizations in order to more quickly orient your audience to the key takeaways. Then, you will put everything you have learned together for the final exercises of the course! |
| 182 | + |
| 183 | +VIEW CHAPTER DETAILS |
0 commit comments