Beautiful plots with Seaborn
Create Plots that get your visualization journey started!
Data visualization techniques allow data scientists to convert raw data into charts and plots that generate valuable insights, reducing the complexity of the data and make it easier to understand for the end user.
Seaborn is a library for making statistical graphics in Python. It builds on top of matplotlib and integrates closely with pandas data structures. Seaborn design allows you to explore and understand your data quickly.
pipenv install seaborn notebook
Additionally, we are going to import a few modules before we get started.
Scatter Plot
A scatter plot is a diagram that displays points based on two dimensions of the dataset. Creating a scatter plot in the seaborn library is so simple and with just one line of code.
sns.scatterplot(data=flights_data, x="year", y="passengers")
Bar Plot
It is probably the best-known type of chart, and as you may have predicted, we can plot this type of plot with seaborn
in the same way we do for lines and scatter plots by using the function barplot
.
sns.barplot(data=flights_data, x="year", y="passengers")
Making beautiful plots with styles
Seaborn gives you the ability to change your graphs’ interface, and it provides five different styles out of the box: darkgrid, whitegrid, dark, white, and ticks.
sns.set_style("darkgrid")
sns.lineplot(data = data, x = "year", y = "passengers")
Heatmap chart
pivot = tips_df.pivot_table(
index=["day"],
columns=["size"],
values="tip_percentage",
aggfunc=np.average)
sns.heatmap(pivot)
Do reach out and comment if you get stuck!
Other articles that might be interested in:
- Pandas 10 minute guide. This will serve as a basic guide to get… | by Sam | Geek Culture | Jan, 2022 | Medium
- Your go to Numpy checklist. A quick glance at all the important… | by Sam | Geek Culture | Jan, 2022 | Medium
- Getting started with Apache Spark — I | by Sam | Geek Culture | Jan, 2022 | Medium
- Streamlit and Palmer Penguins. Binged Atypical last week on Netflix… | by Sam | Geek Culture | Medium
Cheers and do follow for more such content! :)
You can now buy me a coffee too if you liked the content!
samunderscore12 is creating data science content! (buymeacoffee.com)