How to use Seaborn in Python
• 1 minWhy Seaborn?
Seaborn is a fantastic library to do some data visualization and it is built on top of the Matplotlib library.
Seaborn pushed the simplicity of data exploration and data analysis to the extreme.
How to import it
Setting the theme
Loading a dataset
Seaborn is made for data science, so it comes with a lot of available example datasets. At the time of this writing, the library has around 19 different datasets that you can use to practice data exploration and data visualization.
Here we import the tips dataset. This dataset contains servers' tips on a given day, the sex, etc...
One could try to predict the amount that people tip given those characteristics.
tips = sns.load_dataset("tips")
A basic plot
Let's do a basic plot that plots the total_bill and the tip that the customer left in order to see whether there is a linear relationship or not.
Adding some colors
We could and it is always nice to add an extra variable as colors.
Here we have a categorical variable called smoker which tells us whether or not the customer was a smoker.
Here is the plot
sns.relplot(x="total_bill", y="tip", hue="smoker", data=tips)