SlideShare a Scribd company logo
2
Most read
7
Most read
Introduction to
Seaborn
IN TERMEDIATE DATA VIS UALIZ ATION W ITH S EABORN
Chris Mof tt
Instructor
INTERMEDIATE DATA VISUALIZATION WITH SEABORN
Python Visualization Landscape
The python visualization landscape is complex and can be
overwhelming
INTERMEDIATE DATA VISUALIZATION WITH SEABORN
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'])
INTERMEDIATE DATA VISUALIZATION WITH SEABORN
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()
INTERMEDIATE DATA VISUALIZATION WITH SEABORN
Seaborn
Seaborn supports complex visualizations of data
It is built on matplotlib and works best with pandas' dataframes
INTERMEDIATE DATA VISUALIZATION WITH SEABORN
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'])
INTERMEDIATE DATA VISUALIZATION WITH SEABORN
Histogram vs. Distplot
Pandas histogram
df['alcohol'].plot.hist()
Actual frequency of
observations
No automatic labels
Wide bins
Seaborn distplot
sns.distplot(df['alcohol'])
Automatic label on x axis
Muted color palette
KDE plot
Narrow bins
Let's practice!
IN TERMEDIATE DATA VIS UALIZ ATION W ITH S EABORN
Using the
distribution plot
IN TERMEDIATE DATA VIS UALIZ ATION W ITH S EABORN
Chris Mof tt
Instructor
INTERMEDIATE DATA VISUALIZATION WITH SEABORN
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)
INTERMEDIATE DATA VISUALIZATION WITH SEABORN
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)
INTERMEDIATE DATA VISUALIZATION WITH SEABORN
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})
Let's practice!
IN TERMEDIATE DATA VIS UALIZ ATION W ITH S EABORN
Regression Plots in
Seaborn
IN TERMEDIATE DATA VIS UALIZ ATION W ITH S EABORN
Chris Mof tt
Instructor
INTERMEDIATE DATA VISUALIZATION WITH SEABORN
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)
INTERMEDIATE DATA VISUALIZATION WITH SEABORN
lmplot() builds on top of the base regplot()
regplot - low level
sns.regplot(x="alcohol",
y="quality",
data=df)
lmplot - high level
sns.lmplot(x="alcohol",
y="quality",
data=df)
INTERMEDIATE DATA VISUALIZATION WITH SEABORN
lmplot faceting
Organize data by colors (
hue )
sns.lmplot(x="quality",
y="alcohol",
data=df,
hue="type")
Organize data by columns (
col )
sns.lmplot(x="quality",
y="alcohol",
data=df,
col="type")
Let's practice!
IN TERMEDIATE DATA VIS UALIZ ATION W ITH S EABORN

More Related Content

PPTX
Python Seaborn Data Visualization
PPTX
Seaborn.pptx
PPTX
Data visualization using R
PDF
Data visualization in Python
PDF
Data Visualization in Python
ODP
Data Analysis in Python
PPTX
Clustering in data Mining (Data Mining)
PPTX
PYTHON-Chapter 4-Plotting and Data Science PyLab - MAULIK BORSANIYA
Python Seaborn Data Visualization
Seaborn.pptx
Data visualization using R
Data visualization in Python
Data Visualization in Python
Data Analysis in Python
Clustering in data Mining (Data Mining)
PYTHON-Chapter 4-Plotting and Data Science PyLab - MAULIK BORSANIYA

What's hot (20)

PPT
Python Pandas
PPTX
Scikit Learn intro
PPTX
Introduction to matplotlib
PPTX
PPT on Data Science Using Python
PDF
Data Analysis and Visualization using Python
PPTX
Hyperparameter Tuning
PPTX
Data reduction
PPTX
Naive Bayes
PDF
Python Matplotlib Tutorial | Matplotlib Tutorial | Python Tutorial | Python T...
PPTX
Visualization and Matplotlib using Python.pptx
PDF
pandas - Python Data Analysis
PPTX
Convolutional Neural Network - CNN | How CNN Works | Deep Learning Course | S...
PPT
01 Data Mining: Concepts and Techniques, 2nd ed.
PDF
Deep Learning for Graphs
PPT
3.3 hierarchical methods
PPTX
Python Scipy Numpy
PPTX
Presentation on data preparation with pandas
PPTX
OLAP & DATA WAREHOUSE
PPTX
DataFrame in Python Pandas
PPTX
Optimization/Gradient Descent
Python Pandas
Scikit Learn intro
Introduction to matplotlib
PPT on Data Science Using Python
Data Analysis and Visualization using Python
Hyperparameter Tuning
Data reduction
Naive Bayes
Python Matplotlib Tutorial | Matplotlib Tutorial | Python Tutorial | Python T...
Visualization and Matplotlib using Python.pptx
pandas - Python Data Analysis
Convolutional Neural Network - CNN | How CNN Works | Deep Learning Course | S...
01 Data Mining: Concepts and Techniques, 2nd ed.
Deep Learning for Graphs
3.3 hierarchical methods
Python Scipy Numpy
Presentation on data preparation with pandas
OLAP & DATA WAREHOUSE
DataFrame in Python Pandas
Optimization/Gradient Descent
Ad

Similar to 1 seaborn introduction (20)

PPTX
Working with Graphs _python.pptx
PDF
Visualization Lifecycle
PPTX
Unit 4_Working with Graphs _python (2).pptx
PPTX
Bridging Structured and Unstructred Data with Apache Hadoop and Vertica
PPTX
Seaborn-and-Plotly-A-Visual-Exploration-of-Data.pptx
PPTX
Apache pig power_tools_by_viswanath_gangavaram_r&d_dsg_i_labs
PDF
End-to-end Big Data Projects with Python - StampedeCon Big Data Conference 2017
PPTX
Unit 6 Image processing Libraries.[pptx]
PDF
Spark DataFrames for Data Munging
PDF
MLconf NYC Shan Shan Huang
PDF
Seaborn graphing present
PDF
Advanced kapacitor
PDF
MongoDB World 2019: Exploring your MongoDB Data with Pirates (R) and Snakes (...
PPTX
Apache Hadoop India Summit 2011 talk "Pig - Making Hadoop Easy" by Alan Gate
PDF
Hadoop for Data Science: Moving from BI dashboards to R models, using Hive st...
PDF
Atmosphere Conference 2015: Taming the Modern Datacenter
PDF
Bids talk 9.18
PDF
Pdf 이교수의 멘붕하둡_pig
PDF
PPTX
Pig: Data Analysis Tool in Cloud
Working with Graphs _python.pptx
Visualization Lifecycle
Unit 4_Working with Graphs _python (2).pptx
Bridging Structured and Unstructred Data with Apache Hadoop and Vertica
Seaborn-and-Plotly-A-Visual-Exploration-of-Data.pptx
Apache pig power_tools_by_viswanath_gangavaram_r&d_dsg_i_labs
End-to-end Big Data Projects with Python - StampedeCon Big Data Conference 2017
Unit 6 Image processing Libraries.[pptx]
Spark DataFrames for Data Munging
MLconf NYC Shan Shan Huang
Seaborn graphing present
Advanced kapacitor
MongoDB World 2019: Exploring your MongoDB Data with Pirates (R) and Snakes (...
Apache Hadoop India Summit 2011 talk "Pig - Making Hadoop Easy" by Alan Gate
Hadoop for Data Science: Moving from BI dashboards to R models, using Hive st...
Atmosphere Conference 2015: Taming the Modern Datacenter
Bids talk 9.18
Pdf 이교수의 멘붕하둡_pig
Pig: Data Analysis Tool in Cloud
Ad

Recently uploaded (20)

PPTX
Business Acumen Training GuidePresentation.pptx
PDF
.pdf is not working space design for the following data for the following dat...
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PPTX
IB Computer Science - Internal Assessment.pptx
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PPTX
Data_Analytics_and_PowerBI_Presentation.pptx
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PPT
Miokarditis (Inflamasi pada Otot Jantung)
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
PDF
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PPTX
Supervised vs unsupervised machine learning algorithms
PDF
Lecture1 pattern recognition............
PPTX
1_Introduction to advance data techniques.pptx
PDF
Foundation of Data Science unit number two notes
PDF
Business Analytics and business intelligence.pdf
Business Acumen Training GuidePresentation.pptx
.pdf is not working space design for the following data for the following dat...
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
Introduction-to-Cloud-ComputingFinal.pptx
IB Computer Science - Internal Assessment.pptx
Acceptance and paychological effects of mandatory extra coach I classes.pptx
Data_Analytics_and_PowerBI_Presentation.pptx
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
Miokarditis (Inflamasi pada Otot Jantung)
Galatica Smart Energy Infrastructure Startup Pitch Deck
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
Business Ppt On Nestle.pptx huunnnhhgfvu
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
Supervised vs unsupervised machine learning algorithms
Lecture1 pattern recognition............
1_Introduction to advance data techniques.pptx
Foundation of Data Science unit number two notes
Business Analytics and business intelligence.pdf

1 seaborn introduction

  • 1. Introduction to Seaborn IN TERMEDIATE DATA VIS UALIZ ATION W ITH S EABORN Chris Mof tt Instructor
  • 2. INTERMEDIATE DATA VISUALIZATION WITH SEABORN Python Visualization Landscape The python visualization landscape is complex and can be overwhelming
  • 3. INTERMEDIATE DATA VISUALIZATION WITH SEABORN 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'])
  • 4. INTERMEDIATE DATA VISUALIZATION WITH SEABORN 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()
  • 5. INTERMEDIATE DATA VISUALIZATION WITH SEABORN Seaborn Seaborn supports complex visualizations of data It is built on matplotlib and works best with pandas' dataframes
  • 6. INTERMEDIATE DATA VISUALIZATION WITH SEABORN 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'])
  • 7. INTERMEDIATE DATA VISUALIZATION WITH SEABORN Histogram vs. Distplot Pandas histogram df['alcohol'].plot.hist() Actual frequency of observations No automatic labels Wide bins Seaborn distplot sns.distplot(df['alcohol']) Automatic label on x axis Muted color palette KDE plot Narrow bins
  • 8. Let's practice! IN TERMEDIATE DATA VIS UALIZ ATION W ITH S EABORN
  • 9. Using the distribution plot IN TERMEDIATE DATA VIS UALIZ ATION W ITH S EABORN Chris Mof tt Instructor
  • 10. INTERMEDIATE DATA VISUALIZATION WITH SEABORN 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)
  • 11. INTERMEDIATE DATA VISUALIZATION WITH SEABORN 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)
  • 12. INTERMEDIATE DATA VISUALIZATION WITH SEABORN 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})
  • 13. Let's practice! IN TERMEDIATE DATA VIS UALIZ ATION W ITH S EABORN
  • 14. Regression Plots in Seaborn IN TERMEDIATE DATA VIS UALIZ ATION W ITH S EABORN Chris Mof tt Instructor
  • 15. INTERMEDIATE DATA VISUALIZATION WITH SEABORN 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)
  • 16. INTERMEDIATE DATA VISUALIZATION WITH SEABORN lmplot() builds on top of the base regplot() regplot - low level sns.regplot(x="alcohol", y="quality", data=df) lmplot - high level sns.lmplot(x="alcohol", y="quality", data=df)
  • 17. INTERMEDIATE DATA VISUALIZATION WITH SEABORN lmplot faceting Organize data by colors ( hue ) sns.lmplot(x="quality", y="alcohol", data=df, hue="type") Organize data by columns ( col ) sns.lmplot(x="quality", y="alcohol", data=df, col="type")
  • 18. Let's practice! IN TERMEDIATE DATA VIS UALIZ ATION W ITH S EABORN