Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Pandas
  • Matplotlib
  • Plotly
  • Altair
  • Bokeh
  • Data Analysis
  • R
  • Machine Learning Math
  • Machin Learning
  • Deep Learning
  • Deep Learning Projects
  • NLP
  • Computer vision
  • Data science
  • Deep learning interview question
  • Machin Learning Interview question
Open In App
Next Article:
Introduction to Seaborn - Python
Next article icon

Python Seaborn Tutorial

Last Updated : 19 Mar, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Seaborn is a library mostly used for statistical plotting in Python. It is built on top of Matplotlib and provides beautiful default styles and color palettes to make statistical plots more attractive.

In this tutorial, we will learn about Python Seaborn from basics to advance using a huge dataset of seaborn basics, concepts, and different graphs that can be plotted.

Recent articles on Seaborn !!

Getting Started

First of all, let us install Seaborn. Seaborn can be installed using the pip. Type the below command in the terminal.

pip install seaborn

In the terminal, it will look like this - 

After the installation is completed you will get a successfully installed message at the end of the terminal as shown below.

Note: Seaborn has the following dependencies - 

  • Python 2.7 or 3.4+
  • numpy
  • scipy
  • pandas
  • matplotlib

After the installation let us see an example of a simple plot using Seaborn. We will be plotting a simple line plot using the iris dataset. Iris dataset contains five columns such as Petal Length, Petal Width, Sepal Length, Sepal Width and Species Type. Iris is a flowering plant, the researchers have measured various features of the different iris flowers and recorded them digitally.

Example:

Python
# importing packages  import seaborn as sns   # loading dataset  data = sns.load_dataset("iris")   # draw lineplot  sns.lineplot(x="sepal_length", y="sepal_width", data=data)  

Output:

seaborn tutorial simple plot

In the above example, a simple line plot is created using the lineplot() method. Do not worry about these functions as we will be discussing them in detail in the below sections. Now after going through a simple example let us see a brief introduction about the Seaborn. Refer to the below articles to get detailed information about the same.

  • Introduction to Seaborn – Python
  • Plotting graph using Seaborn

In the introduction, you must have read that Seaborn is built on the top of Matplotlib. It means that Seaborn can be used with Matplotlib. 

Using Seaborn with Matplotlib

Using both Matplotlib and Seaborn together is a very simple process. We just have to invoke the Seaborn Plotting function as normal, and then we can use Matplotlib's customization function.

Example 1: We will be using the above example and will add the title to the plot using the Matplotlib.

Python
# importing packages  import seaborn as sns  import matplotlib.pyplot as plt   # loading dataset  data = sns.load_dataset("iris")   # draw lineplot  sns.lineplot(x="sepal_length", y="sepal_width", data=data)   # setting the title using Matplotlib plt.title('Title using Matplotlib Function')  plt.show() 

Output:

Example 2: Setting the xlim and ylim

Python
# importing packages  import seaborn as sns  import matplotlib.pyplot as plt   # loading dataset  data = sns.load_dataset("iris")   # draw lineplot  sns.lineplot(x="sepal_length", y="sepal_width", data=data)   # setting the x limit of the plot plt.xlim(5)  plt.show() 

Output:

seaborn tutorial working with matplotlib

Customizing Seaborn Plots

Seaborn comes with some customized themes and a high-level interface for customizing the looks of the graphs. Consider the above example where the default of the Seaborn is used. It still looks nice and pretty but we can customize the graph according to our own needs. So let's see the styling of plots in detail.

Changing Figure Aesthetic

set_style() method is used to set the aesthetic of the plot. It means it affects things like the color of the axes, whether the grid is active or not, or other aesthetic elements. There are five themes available in Seaborn.

  • darkgrid
  • whitegrid
  • dark
  • white
  • ticks

Syntax:

set_style(style=None, rc=None)

Example: Using the dark theme

Python
# importing packages  import seaborn as sns  import matplotlib.pyplot as plt   # loading dataset  data = sns.load_dataset("iris")   # draw lineplot  sns.lineplot(x="sepal_length", y="sepal_width", data=data)   # changing the theme to dark sns.set_style("dark") plt.show() 

Output:

seaborn tutorial styling plots

Removal of Spines

Spines are the lines noting the data boundaries and connecting the axis tick marks. It can be removed using the despine() method.

Syntax:

sns.despine(left = True)

Example:

Python
# importing packages  import seaborn as sns  import matplotlib.pyplot as plt   # loading dataset  data = sns.load_dataset("iris")   # draw lineplot  sns.lineplot(x="sepal_length", y="sepal_width", data=data)   # Removing the spines sns.despine() plt.show() 

Output:

seaborn tutorial removing spines

Changing the figure Size

The figure size can be changed using the figure() method of Matplotlib. figure() method creates a new figure of the specified size passed in the figsize parameter.

Example:

Python
# importing packages  import seaborn as sns  import matplotlib.pyplot as plt   # loading dataset  data = sns.load_dataset("iris")   # changing the figure size plt.figure(figsize = (2, 4))  # draw lineplot  sns.lineplot(x="sepal_length", y="sepal_width", data=data)   # Removing the spines sns.despine()  plt.show() 

Output:

seaborn tutorial changing figure size

Scaling the plots

It can be done using the set_context() method. It allows us to override default parameters. This affects things like the size of the labels, lines, and other elements of the plot, but not the overall style. The base context is “notebook”, and the other contexts are “paper”, “talk”, and “poster”. font_scale sets the font size.

Syntax:

set_context(context=None, font_scale=1, rc=None)

Example:

Python
# importing packages  import seaborn as sns  import matplotlib.pyplot as plt   # loading dataset  data = sns.load_dataset("iris")   # draw lineplot  sns.lineplot(x="sepal_length", y="sepal_width", data=data)   # Setting the scale of the plot sns.set_context("paper")  plt.show() 

Output:

seaborn tutorial setting the scale

Setting the Style Temporarily

axes_style() method is used to set the style temporarily. It is used along with the with statement.

Syntax:

axes_style(style=None, rc=None)

Example:

Python
# importing packages  import seaborn as sns  import matplotlib.pyplot as plt   # loading dataset  data = sns.load_dataset("iris")    def plot():     sns.lineplot(x="sepal_length", y="sepal_width", data=data)   with sns.axes_style('darkgrid'):          # Adding the subplot     plt.subplot(211)     plot()      plt.subplot(212) plot() 

Output:

Refer to the below article for detailed information about styling Seaborn Plot.

  • Seaborn | Style And Color

Color Palette

Colormaps are used to visualize plots effectively and easily. One might use different sorts of colormaps for different kinds of plots. color_palette() method is used to give colors to the plot. Another function palplot() is used to deal with the color palettes and plots the color palette as a horizontal array.

Example:

Python
# importing packages  import seaborn as sns  import matplotlib.pyplot as plt  # current colot palette palette = sns.color_palette()  # plots the color palette as a # horizontal array sns.palplot(palette)  plt.show() 

Output:

Diverging Color Palette

This type of color palette uses two different colors where each color depicts different points ranging from a common point in either direction. Consider a range of -10 to 10 so the value from -10 to 0 takes one color and values from 0 to 10 take another.

Example:

Python
# importing packages  import seaborn as sns  import matplotlib.pyplot as plt  # current colot palette palette = sns.color_palette('PiYG', 11)  # diverging color palette sns.palplot(palette)  plt.show() 

Output:

seaborn tutorial diverging color

In the above example, we have used an in-built diverging color palette which shows 11 different points of color. The color on the left shows pink color and color on the right shows green color.

Sequential Color Palette

A sequential palette is used where the distribution ranges from a lower value to a higher value. To do this add the character 's' to the color passed in the color palette.

Example:

Python
# importing packages  import seaborn as sns  import matplotlib.pyplot as plt  # current colot palette palette = sns.color_palette('Greens', 11)  # sequential color palette sns.palplot(palette)  plt.show() 

Output:

seaborn tutorial sequential color palette

Setting the default Color Palette

set_palette() method is used to set the default color palette for all the plots. The arguments for both color_palette() and set_palette() is same. set_palette() changes the default matplotlib parameters.

Example:

Python
# importing packages  import seaborn as sns  import matplotlib.pyplot as plt  # loading dataset  data = sns.load_dataset("iris")   def plot():     sns.lineplot(x="sepal_length", y="sepal_width", data=data)  # setting the default color palette sns.set_palette('vlag') plt.subplot(211)  # plotting with the color palette # as vlag plot()  # setting another default color palette sns.set_palette('Accent') plt.subplot(212) plot()  plt.show() 

Output:

Refer to the below article to get detailed information about the color palette.

  • Seaborn – Color Palette

Multiple plots with Seaborn

You might have seen multiple plots in the above examples and some of you might have got confused. Don't worry we will cover multiple plots in this section. Multiple plots in Seaborn can also be created using the Matplotlib as well as Seaborn also provides some functions for the same.

Using Matplotlib

Matplotlib provides various functions for plotting subplots. Some of them are add_axes(), subplot(), and subplot2grid(). Let's see an example of each function for better understanding.

Example 1: Using add_axes() method

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt   # loading dataset data = sns.load_dataset("iris")  def graph():     sns.lineplot(x="sepal_length", y="sepal_width", data=data)  # Creating a new figure with width = 5 inches # and height = 4 inches fig = plt.figure(figsize =(5, 4))   # Creating first axes for the figure ax1 = fig.add_axes([0.1, 0.1, 0.8, 0.8])   # plotting the graph graph()  # Creating second axes for the figure ax2 = fig.add_axes([0.5, 0.5, 0.3, 0.3])  # plotting the graph graph()  plt.show() 

Output:

seaborn tutorial add axes

Example 2: Usingsubplot() method

Python
# importing packages  import seaborn as sns  import matplotlib.pyplot as plt  # loading dataset  data = sns.load_dataset("iris")   def graph():     sns.lineplot(x="sepal_length", y="sepal_width", data=data)  # Adding the subplot at the specified # grid position plt.subplot(121) graph()  # Adding the subplot at the specified # grid position plt.subplot(122) graph()  plt.show() 

Output:

seaborn tutorial subplot

Example 3: Using subplot2grid() method

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  def graph():     sns.lineplot(x="sepal_length", y="sepal_width", data=data)  # adding the subplots axes1 = plt.subplot2grid (   (7, 1), (0, 0), rowspan = 2,  colspan = 1)  graph()  axes2 = plt.subplot2grid (   (7, 1), (2, 0), rowspan = 2, colspan = 1)  graph()    axes3 = plt.subplot2grid (   (7, 1), (4, 0), rowspan = 2, colspan = 1) graph() 

Output:

Using Seaborn 

Seaborn also provides some functions for plotting multiple plots. Let's see them in detail

Method 1: Using FacetGrid() method

  • FacetGrid class helps in visualizing distribution of one variable as well as the relationship between multiple variables separately within subsets of your dataset using multiple panels.
  • A FacetGrid can be drawn with up to three dimensions ? row, col, and hue. The first two have obvious correspondence with the resulting array of axes; think of the hue variable as a third dimension along a depth axis, where different levels are plotted with different colors.
  • FacetGrid object takes a dataframe as input and the names of the variables that will form the row, column, or hue dimensions of the grid. The variables should be categorical and the data at each level of the variable will be used for a facet along that axis.

Syntax:

seaborn.FacetGrid( data, \*\*kwargs)

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  plot = sns.FacetGrid(data, col="species") plot.map(plt.plot, "sepal_width")  plt.show() 

Output:


seaborn tutorial facetgrid

Method 2: Using PairGrid() method

  • Subplot grid for plotting pairwise relationships in a dataset.
  • This class maps each variable in a dataset onto a column and row in a grid of multiple axes. Different axes-level plotting functions can be used to draw bivariate plots in the upper and lower triangles, and the marginal distribution of each variable can be shown on the diagonal.
  • It can also represent an additional level of conventionalization with the hue parameter, which plots different subsets of data in different colors. This uses color to resolve elements on a third dimension, but only draws subsets on top of each other and will not tailor the hue parameter for the specific visualization the way that axes-level functions that accept hue will.

Syntax:

seaborn.PairGrid( data, \*\*kwargs)

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("flights")  plot = sns.PairGrid(data) plot.map(plt.plot)  plt.show() 

Output:

seaborn tutorial pairgrid

Refer to the below articles to get detailed information about the multiple plots

  • Python – seaborn.FacetGrid() method
  • Python – seaborn.PairGrid() method

Creating Different Types of Plots

Relational Plots

Relational plots are used for visualizing the statistical relationship between the data points. Visualization is necessary because it allows the human to see trends and patterns in the data. The process of understanding how the variables in the dataset relate each other and their relationships are termed as Statistical analysis. Refer to the below articles for detailed information.

  • Relational plots in Seaborn – Part I
  • Relational plots in Seaborn – Part II

There are different types of Relational Plots. We will discuss each of them in detail -

Relplot()

This function provides us the access to some other different axes-level functions which shows the relationships between two variables with semantic mappings of subsets. It is plotted using the relplot() method.

Syntax:

seaborn.relplot(x=None, y=None, data=None, **kwargs) 

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  # creating the relplot sns.relplot(x='sepal_width', y='species', data=data)  plt.show() 

Output:

seaborn tutorial relplot

Scatter Plot

The scatter plot is a mainstay of statistical visualization. It depicts the joint distribution of two variables using a cloud of points, where each point represents an observation in the dataset. This depiction allows the eye to infer a substantial amount of information about whether there is any meaningful relationship between them. It is plotted using the scatterplot() method.

Syntax:

seaborn.scatterplot(x=None, y=None, data=None, **kwargs)

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.scatterplot(x='sepal_length', y='sepal_width', data=data) plt.show() 

Output:

seaborn tutorial scatterplot

Refer to the below articles to get detailed information about Scatter plot.

  • Scatterplot using Seaborn in Python
  • Visualizing Relationship between variables with scatter plots in Seaborn
  • How To Make Scatter Plot with Regression Line using Seaborn in Python?
  • Scatter Plot with Marginal Histograms in Python with Seaborn

Line Plot

For certain datasets, you may want to consider changes as a function of time in one variable, or as a similarly continuous variable. In this case, drawing a line-plot is a better option. It is plotted using the lineplot() method.

Syntax:

seaborn.lineplot(x=None, y=None, data=None, **kwargs)

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.lineplot(x='sepal_length', y='species', data=data) plt.show() 

Output:

seaborn tutorial lineplot

Refer to the below articles to get detailed information about line plot.

  • seaborn.lineplot() method in Python
  • Data Visualization with Seaborn Line Plot
  • Creating A Time Series Plot With Seaborn And Pandas
  • How to Make a Time Series Plot with Rolling Average in Python?

Categorical Plots

Categorical Plots are used where we have to visualize relationship between two numerical values. A more specialized approach can be used if one of the main variable is categoricalwhich means such variables that take on a fixed and limited number of possible values.

Refer to the below articles to get detailed information.

  • Categorical Plots

 There are various types of categorical plots let's discuss each one them in detail.

Bar Plot

A barplot is basically used to aggregate the categorical data according to some methods and by default its the mean. It can also be understood as a visualization of the group by action. To use this plot we choose a categorical column for the x axis and a numerical column for the y axis and we see that it creates a plot taking a mean per categorical column. It can be created using the barplot() method.

Syntax:

barplot([x, y, hue, data, order, hue_order, …])

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.barplot(x='species', y='sepal_length', data=data) plt.show() 

Output:

seabon tutorial barplot

Refer to the below article to get detailed information about the topic.

  • Seaborn.barplot() method in Python
  • Barplot using seaborn in Python
  • Seaborn – Sort Bars in Barplot

Count Plot

A countplot basically counts the categories and returns a count of their occurrences. It is one of the most simple plots provided by the seaborn library. It can be created using the countplot() method.

Syntax:

countplot([x, y, hue, data, order, …])

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.countplot(x='species', data=data) plt.show() 

Output:

Seaborn tutorial countplot

Refer to the below articles t get detailed information about the count plot.

  • Countplot using seaborn in Python

Box Plot

A boxplot is sometimes known as the box and whisker plot.It shows the distribution of the quantitative data that represents the comparisons between variables. boxplot shows the quartiles of the dataset while the whiskers extend to show the rest of the distribution i.e. the dots indicating the presence of outliers. It is created using the boxplot() method.

Syntax:

boxplot([x, y, hue, data, order, hue_order, …])

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.boxplot(x='species', y='sepal_width', data=data) plt.show() 

Output:

seaborn tutorial box plot

Refer to the below articles to get detailed information about box plot.

  • Boxplot using Seaborn in Python
  • Horizontal Boxplots with Seaborn in Python
  • How To Use Seaborn Color Palette to Color Boxplot?
  • Seaborn – Coloring Boxplots with Palettes
  • How to Show Mean on Boxplot using Seaborn in Python?
  • Sort Boxplot by Mean with Seaborn in Python
  • How To Manually Order Boxplot in Seaborn?
  • Grouped Boxplots in Python with Seaborn
  • Horizontal Boxplots with Points using Seaborn in Python
  • How to Make Boxplots with Data Points using Seaborn in Python?
  • Box plot visualization with Pandas and Seaborn

Violinplot

It is similar to the boxplot except that it provides a higher, more advanced visualization and uses the kernel density estimation to give a better description about the data distribution. It is created using the violinplot() method.

Syntax:

violinplot([x, y, hue, data, order, …]

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.violinplot(x='species', y='sepal_width', data=data) plt.show() 

Output:

seaborn tutorial violinpot

Refer to the below articles to get detailed information about violin plot.

  • Violinplot using Seaborn in Python
  • How to Make Horizontal Violin Plot with Seaborn in Python?
  • Make Violinplot with data points using Seaborn
  • How To Make Violinpot with data points in Seaborn?
  • How to Make Grouped Violinplot with Seaborn in Python?

Stripplot

It basically creates a scatter plot based on the category. It is created using the stripplot() method.

Syntax:

stripplot([x, y, hue, data, order, …])

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.stripplot(x='species', y='sepal_width', data=data) plt.show() 

Output:

seaborn tutorial stripplot


Refer to the below articles to detailed information about strip plot.

  • Stripplot using Seaborn in Python

Swarmplot

Swarmplot is very similar to the stripplot except the fact that the points are adjusted so that they do not overlap.Some people also like combining the idea of a violin plot and a stripplot to form this plot. One drawback to using swarmplot is that sometimes they dont scale well to really large numbers and takes a lot of computation to arrange them. So in case we want to visualize a swarmplot properly we can plot it on top of a violinplot. It is plotted using the swarmplot() method.

Syntax:

swarmplot([x, y, hue, data, order, …])

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.swarmplot(x='species', y='sepal_width', data=data) plt.show() 

Output:

seaborn tutorial swarmplot

Refer to the below articles to get detailed information about swarmplot.

  • Python – seaborn.swarmplot() method
  • Swarmplot using Seaborn in Python

Factorplot

Factorplot is the most general of all these plots and provides a parameter called kind to choose the kind of plot we want thus saving us from the trouble of writing these plots separately. The kind parameter can be bar, violin, swarm etc. It is plotted using the factorplot() method.

Syntax:

sns.factorplot([x, y, hue, data, row, col, …])

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.factorplot(x='species', y='sepal_width', data=data) plt.show() 

 Output:

seaborn tutorial factorplot

Refer to the below articles to get detailed information about the factor plot.

  • Python – seaborn.factorplot() method
  • Plotting different types of plots using Factor plot in seaborn

Distribution Plots

Distribution Plots are used for examining univariate and bivariate distributions meaning such distributions that involve one variable or two discrete variables.

Refer to the below article to get detailed information about the distribution plots.

  • Distribution Plots

There are various types of distribution plots let's discuss each one them in detail.

Histogram

A histogram is basically used to represent data provided in a form of some groups.It is accurate method for the graphical representation of numerical data distribution. It can be plotted using the histplot() function.

Syntax:

histplot(data=None, *, x=None, y=None, hue=None,  **kwargs)

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.histplot(x='species', y='sepal_width', data=data) plt.show() 

Output:

seaborn tutorial histogram

Refer to the below articles to get detailed information about histplot.

  • How to Make Histograms with Density Plots with Seaborn histplot?
  • How to Add Outline or Edge Color to Histogram in Seaborn?
  • Scatter Plot with Marginal Histograms in Python with Seaborn

Distplot

Distplot is used basically for univariant set of observations and visualizes it through a histogram i.e. only one observation and hence we choose one particular column of the dataset. It is potted using the distplot() method.

Syntax:

distplot(a[, bins, hist, kde, rug, fit, ...])

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.distplot(data['sepal_width']) plt.show() 

Output:

seaborn tutorial distplot

Jointplot

Jointplot is used to draw a plot of two variables with bivariate and univariate graphs. It basically combines two different plots. It is plotted using the jointplot() method.

Syntax:

jointplot(x, y[, data, kind, stat_func, ...])

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.jointplot(x='species', y='sepal_width', data=data) plt.show() 

Output:

seaborn tutorial jointplot

Refer to the below articles to get detailed information about the topic.

  • Python – seaborn.jointplot() method

Pairplot

Pairplot represents pairwise relation across the entire dataframe and supports an additional argument called hue for categorical separation. What it does basically is create a jointplot between every possible numerical column and takes a while if the dataframe is really huge. It is plotted using the pairplot() method.

Syntax:

pairplot(data[, hue, hue_order, palette, …])

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.pairplot(data=data, hue='species') plt.show() 

Output:

seaborn tutorial pairplot

Refer to the below articles to get detailed information about the pairplot.

  • Python – seaborn.pairplot() method
  • Data visualization with Pairplot Seaborn and Pandas

Rugplot

Rugplot plots datapoints in an array as sticks on an axis.Just like a distplot it takes a single column. Instead of drawing a histogram it creates dashes all across the plot. If you compare it with the joinplot you can see that what a jointplot does is that it counts the dashes and shows it as bins. It is plotted using the rugplot() method.

Syntax:

rugplot(a[, height, axis, ax])

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.rugplot(data=data) plt.show() 

Output:

seaborn tutorial rugplot

KDE Plot

KDE Plot described as Kernel Density Estimate is used for visualizing the Probability Density of a continuous variable. It depicts the probability density at different values in a continuous variable. We can also plot a single graph for multiple samples which helps in more efficient data visualization.

Syntax:

seaborn.kdeplot(x=None, *, y=None, vertical=False, palette=None, **kwargs)

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("iris")  sns.kdeplot(x='sepal_length', y='sepal_width', data=data) plt.show() 

Output:

seaborn tutorial kdeplot

Refer to the below articles to getdetailed information about the topic.

  • Seaborn Kdeplot – A Comprehensive Guide
  • KDE Plot Visualization with Pandas and Seaborn

Regression Plots

The regression plots are primarily intended to add a visual guide that helps to emphasize patterns in a dataset during exploratory data analyses. Regression plots as the name suggests creates a regression line between two parameters and helps to visualize their linear relationships.

Refer to the below article to get detailed information about the regression plots.

  • Regression Plots

there are two main functions that are used to draw linear regression models. These functions are lmplot(), and regplot(), are closely related to each other. They even share their core functionality.

lmplot

lmplot() method can be understood as a function that basically creates a linear model plot. It creates a scatter plot with a linear fit on top of it.

Syntax:

seaborn.lmplot(x, y, data, hue=None, col=None, row=None, **kwargs)

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("tips")  sns.lmplot(x='total_bill', y='tip', data=data) plt.show() 

Output:

seaborn tutorial lmplot

Refer to the below articles to get detailed information about the lmplot.

  • Python – seaborn.lmplot() method

Regplot

regplot() method is also similar to lmplot which creates linear regression model.

Syntax:

seaborn.regplot( x,  y,  data=None, x_estimator=None, **kwargs)

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("tips")  sns.regplot(x='total_bill', y='tip', data=data) plt.show() 

Output:


Refer to the below articles to get detailed information about regplot.

  • Python – seaborn.regplot() method

Note: The difference between both the function is that regplot accepts the x, y variables in different format including NumPy arrays, Pandas objects, whereas, the lmplot only accepts the value as strings.

Matrix Plots

A matrix plot means plotting matrix data where color coded diagrams shows rows data, column data and values. It can shown using the heatmap and clustermap.

Refer to the below articles to get detailed information about the matrix plots.

  • Matrix plots

Heatmap

Heatmap is defined as a graphical representation of data using colors to visualize the value of the matrix. In this, to represent more common values or higher activities brighter colors basically reddish colors are used and to represent less common or activity values, darker colors are preferred. it can be plotted using the heatmap() function.

Syntax:

seaborn.heatmap(data, *, vmin=None, vmax=None, cmap=None, center=None, annot_kws=None, linewidths=0, linecolor=’white’, cbar=True, **kwargs)

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("tips")  # correlation between the different parameters  tc = data.corr()  sns.heatmap(tc) plt.show() 

Output:

seaborn tutorial heatmap

Refer to the below articles to get detailed information about the heatmap.

  • Seaborn Heatmap – A comprehensive guide
  • How to create a seaborn correlation heatmap in Python?
  • How to create a Triangle Correlation Heatmap in seaborn – Python?
  • ColorMaps in Seaborn HeatMaps
  • How to change the colorbar size of a seaborn heatmap figure in Python?
  • How to add a frame to a seaborn heatmap figure in Python?
  • How to increase the size of the annotations of a seaborn heatmap in Python?

Clustermap

The clustermap() function of seaborn plots the hierarchically-clustered heatmap of the given matrix dataset. Clustering simply means grouping data based on relationship among the variables in the data.

Syntax:

clustermap(data, *, pivot_kws=None,  **kwargs)

Example:

Python
# importing packages import seaborn as sns import matplotlib.pyplot as plt  # loading dataset data = sns.load_dataset("tips")  # correlation between the different parameters  tc = data.corr()  sns.clustermap(tc) plt.show() 

Output:

seaborn tutorial clustermap

Refer to the below articles to get detailed information about clustermap.

  • Hierarchically-clustered Heatmap in Python with Seaborn Clustermap
  • Exploring Correlation in Python

More Gaphs in Seaborn

  • Seaborn – Bubble Plot
  • Python – seaborn.residplot() method
  • Python – seaborn.boxenplot() method
  • Python – seaborn.pointplot() method
  • Python Seaborn – Catplot
  • How to Make Countplot or barplot with Seaborn Catplot?
  • How To Make Grouped Boxplot with Seaborn Catplot?
  • Python Seaborn – Strip plot illustration using Catplot
  • How To Make Simple Facet Plots with Seaborn Catplot in Python?
  • How To Make Ridgeline plot in Python with Seaborn?

More Topics on Seaborn

  • Change Axis Labels, Set Title and Figure Size to Plots with Seaborn
  • How To Place Legend Outside the Plot with Seaborn in Python?
  • How to Plot a Confidence Interval in Python?
  • Creating A Time Series Plot With Seaborn And Pandas
  • How to Make a Time Series Plot with Rolling Average in Python?
  • How To Add Regression Line Per Group with Seaborn in Python?
  • Data Visualization with Python Seaborn and Pandas
  • Data Visualization in Python using Matplotlib and Seaborn
  • Visualizing ML DataSet Through Seaborn Plots and Matplotlib

Next Article
Introduction to Seaborn - Python
author
abhishek1
Improve
Article Tags :
  • Python
  • Python-Seaborn
Practice Tags :
  • python

Similar Reads

    Introduction

    • Seaborn is a library mostly used for statistical plotting in Python. It is built on top of Matplotlib and provides beautiful default styles and color palettes to make statistical plots more attractive. In this tutorial, we will learn about Python Seaborn from basics to advance using a huge dataset o
      15+ min read

    • Prerequisite - Matplotlib Library  Visualization is an important part of storytelling, we can gain a lot of information from data by simply just plotting the features of data. Python provides a numerous number of libraries for data visualization, we have already seen the Matplotlib library in this a
      5 min read

    • This article will introduce you to graphing in Python with Seaborn, which is the most popular statistical visualization library in Python. Installation: The easiest way to install seaborn is to use pip. Type following command in terminal:   pip install seaborn OR, you can download it from here and i
      8 min read

    Styling Plots

    • Seaborn is a statistical plotting library in python. It has beautiful default styles. This article deals with the ways of styling the different kinds of plots in seaborn.  Seaborn Figure Styles This affects things like the color of the axes, whether a grid is enabled by default, and other aesthetic
      4 min read

    • In this article, We are going to see seaborn color_palette(), which can be used for coloring the plot. Using the palette we can generate the point with different colors. Example: [GFGTABS] Python import seaborn as sns import matplotlib.pyplot as plt # Set a Seaborn color palette sns.set_palette(
      3 min read

    Multiple Plots

    • Prerequisite: Seaborn Programming Basics Seaborn is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics. Seaborn helps resolve the two major problems faced by Matplotlib; the problems are ? Default Ma
      3 min read

    • Prerequisite: Seaborn Programming Basics Seaborn is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics. Seaborn helps resolve the two major problems faced by Matplotlib; the problems are ? Default Ma
      3 min read

    Scatter Plot

    • Seaborn is an amazing visualization library for statistical graphics plotting in Python. It provides beautiful default styles and color palettes to make statistical plots more attractive. It is built on the top of matplotlib library and also closely integrated into the data structures from pandas.
      4 min read

    • To understand how variables in a dataset are related to one another and how that relationship is dependent on other variables, we perform statistical analysis. This Statistical analysis helps to visualize the trends and identify various patterns in the dataset. One of the functions which can be used
      2 min read

    • In this article, we will learn how to male scatter plots with regression lines using Seaborn in Python. Let's discuss some concepts : Seaborn : Seaborn is a tremendous visualization library for statistical graphics plotting in Python. It provides beautiful default styles and color palettes to make s
      2 min read

    • Prerequisites: Seaborn  Scatter Plot with Marginal Histograms is basically a joint distribution plot with the marginal distributions of the two variables. In data visualization, we often plot the joint behavior of two random variables (bi-variate distribution) or any number of random variables. But
      2 min read

    Line Plot

    • Prerequisite: SeabornMatplotlib  Presenting data graphically to emit some information is known as data visualization. It basically is an image to help a person interpret what the data represents and study it and its nature in detail. Dealing with large scale data row-wise is an extremely tedious tas
      4 min read

    • In this article, we will learn how to create A Time Series Plot With Seaborn And Pandas. Let's discuss some concepts : Pandas is an open-source library that's built on top of NumPy library. It's a Python package that gives various data structures and operations for manipulating numerical data and st
      4 min read

    • Time Series Plot is used to observe various trends in the dataset over a period of time. In such problems, the data is ordered by time and can fluctuate by the unit of time considered in the dataset (day, month, seconds, hours, etc.). When plotting the time series data, these fluctuations may preven
      4 min read

    Bar Plot

    • Seaborn is an amazing visualization library for statistical graphics plotting in Python. It provides beautiful default styles and color palettes to make statistical plots more attractive. It is built on the top of matplotlib library and also closely integrated to the data structures from pandas.  Se
      7 min read

    • Prerequisite: Seaborn, Barplot In this article, we are going to see how to sort the bar in barplot using Seaborn in python. Seaborn is an amazing visualization library for statistical graphics plotting in Python. It provides beautiful default styles and color palettes to make statistical plots more
      3 min read

    Count Plot

    • seaborn.countplot() is a function in the Seaborn library in Python used to display the counts of observations in categorical data. It shows the distribution of a single categorical variable or the relationship between two categorical variables by creating a bar plot. Example: [GFGTABS] Python import
      8 min read

    Box Plot

    • Boxplot is used to see the distribution of numerical data and identify key stats like minimum and maximum values, median, identifying outliers, understanding how data is distributed and can compare the distribution of data across different categories or variables. In Seaborn the seaborn.boxplot() fu
      3 min read

    • Prerequisite: seaborn The Boxplots are used to visualize the distribution of data which is useful when a comparison of data is required. Sometimes, Boxplot is also known as a box-and-whisker plot. The box shows the quartiles of dataset and whiskers extend to show rest of the distribution. In this ar
      1 min read

    • Adding the right set of color with your data visualization makes it more impressive and readable, seaborn color palettes make it easy to use colors with your visualization. In this article, we will see how to color boxplot with seaborn color palettes also learn the uses of seaborn color palettes and
      2 min read

    • A boxplot is a powerful data visualization tool used to understand the distribution of data. It splits the data into quartiles, and summarises it based on five numbers derived from these quartiles: median: the middle value of data. marked as Q2, portrays the 50th percentile.first quartile: the middl
      2 min read

    • Seaborn is an amazing visualization library for statistical graphics plotting in Python. It provides beautiful default styles and color palettes to make statistical plots more attractive. It is built on the top of matplotlib library and also closely integrated into the data structures from pandas.Se
      3 min read

    • Boxplot depicts the distribution of quantitative data facilitating comparisons between different variables, continuous or categorical. It is a common data dispersion measure. Boxplots consist of a five-number summary which helps in detecting and removing outliers from the dataset. Minimum observatio
      2 min read

    • Box Plot is the visual representation of the depicting groups of numerical data through their quartiles. Boxplot is also used for detect the outlier in data set. It captures the summary of the data efficiently with a simple box and whiskers and allows us to compare easily across groups. Boxplot summ
      3 min read

    Violin Plot

    • Seaborn is an amazing visualization library for statistical graphics plotting in Python. It provides beautiful default styles and color palettes to make statistical plots more attractive. It is built on the top of matplotlib library and also closely integrated into the data structures from pandas. V
      7 min read

    • In this article, we are going to plot a horizontal Violin plot with seaborn. We can use two methods for the Drawing horizontal Violin plot, Violinplot() and catplot(). Method 1: Using violinplot() A violin plot plays a similar activity that is pursued through whisker or box plot do. As it shows seve
      3 min read

    • This article depicts how to make a grouped violinplot with Seaborn in python. Violinplot is a great way of visualizing the data as a combination of the box plot with the kernel density plots to produce a new type of plot.  For this article, we will be using the iris dataset to plot data. This comes
      3 min read

    Strip Plot

    • Seaborn is an amazing visualization library for statistical graphics plotting in Python. It provides beautiful default styles and color palettes to make statistical plots more attractive. It is built on top of the matplotlib library and also closely integrated into the data structures from pandas. S
      5 min read

geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences