introduction to seaborn
play

Introduction to Seaborn DATA VIS UALIZ ATION W ITH S EABORN - PowerPoint PPT Presentation

Introduction to Seaborn DATA VIS UALIZ ATION W ITH S EABORN Chris Moftt Instructor Python Visualization Landscape The python visualization landscape is complex and can be overwhelming DATA VISUALIZATION WITH SEABORN Matplotlib


  1. Introduction to Seaborn DATA VIS UALIZ ATION W ITH S EABORN Chris Mof�tt Instructor

  2. Python Visualization Landscape The python visualization landscape is complex and can be overwhelming DATA VISUALIZATION WITH SEABORN

  3. Matplotlib matplotlib provides the raw building blocks for Seaborn's visualizations It can also be used on its own to plot data import matplotlib.pyplot as plt import pandas as pd df = pd.read_csv("wines.csv") fig, ax = plt.subplots() ax.hist(df['alcohol']) DATA VISUALIZATION WITH SEABORN

  4. Pandas pandas is a foundational library for analyzing data It also supports basic plotting capability import pandas as pd df = pd.read_csv("wines.csv") df['alcohol'].plot.hist() DATA VISUALIZATION WITH SEABORN

  5. Seaborn Seaborn supports complex visualizations of data It is built on matplotlib and works best with pandas' dataframes DATA VISUALIZATION WITH SEABORN

  6. Seaborn The distplot is similar to the histogram shown in previous examples By default, generates a Gaussian Kernel Density Estimate (KDE) import seaborn as sns sns.distplot(df['alcohol']) DATA VISUALIZATION WITH SEABORN

  7. Histogram vs. Distplot Pandas histogram Seaborn distplot df['alcohol'].plot.hist() sns.distplot(df['alcohol']) Actual frequency of Automatic label on x axis observations Muted color palette No automatic labels KDE plot Wide bins Narrow bins DATA VISUALIZATION WITH SEABORN

  8. Let's practice! DATA VIS UALIZ ATION W ITH S EABORN

  9. Using the distribution plot DATA VIS UALIZ ATION W ITH S EABORN Chris Mof�tt Instructor

  10. Creating a histogram Distplot function has multiple optional arguments In order to plot a simple histogram, you can disable the kde and specify the number of bins to use sns.distplot(df['alcohol'], kde=False, bins=10) DATA VISUALIZATION WITH SEABORN

  11. Alternative data distributions A rug plot is an alternative way to view the distribution of data A kde curve and rug plot can be combined sns.distplot(df_wines['alcohol'], hist=False, rug=True) DATA VISUALIZATION WITH SEABORN

  12. Further Customizations The distplot function uses several functions including kdeplot and rugplot It is possible to further customize a plot by passing arguments to the underlying function sns.distplot(df_wines['alcohol'], hist=False, rug=True, kde_kws={'shade':True}) DATA VISUALIZATION WITH SEABORN

  13. Let's practice! DATA VIS UALIZ ATION W ITH S EABORN

  14. Regression Plots in Seaborn DATA VIS UALIZ ATION W ITH S EABORN Chris Mof�tt Instructor

  15. Introduction to regplot The regplot function generates a scatter plot with a regression line Usage is similar to the distplot The data and x and y variables must be de�ned sns.regplot(x="alcohol", y="pH", data=df) DATA VISUALIZATION WITH SEABORN

  16. lmplot() builds on top of the base regplot() regplot - low level lmplot - high level sns.regplot(x="alcohol", sns.lmplot(x="alcohol", y="quality", y="quality", data=df) data=df) DATA VISUALIZATION WITH SEABORN

  17. lmplot faceting Organize data by colors ( Organize data by columns ( hue ) col ) sns.lmplot(x="quality", sns.lmplot(x="quality", y="alcohol", y="alcohol", data=df, data=df, hue="type") col="type") DATA VISUALIZATION WITH SEABORN

  18. Let's practice! DATA VIS UALIZ ATION W ITH S EABORN

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend