Plotting graph using Seaborn | Python (original) (raw)

Last Updated : 24 Feb, 2026

Seaborn is a Python data visualization library built on top of Matplotlib. It provides a high-level interface for drawing attractive, informative statistical graphics. Unlike Matplotlib, Seaborn works seamlessly with Pandas DataFrames, making it a preferred tool for quick exploratory data analysis and advanced statistical plotting.

Different Plots in Seaborn

Let's see the various types of plots in seaborn,

1. Strip Plot

A strip plot is a categorical scatter plot where data points are plotted along one categorical axis. It is useful for visualizing the distribution of values but may suffer from overlapping points.

**Applications

**Advantages

**Limitations

import matplotlib.pyplot as plt import seaborn as sns

x = ['sun', 'mon', 'fri', 'sat', 'tue', 'wed', 'thu'] y = [5, 6.7, 4, 6, 2, 4.9, 1.8]

ax = sns.stripplot(x=x, y=y) ax.set(xlabel='Days', ylabel='Amount Spent') plt.title('Daily Spending (Custom Data)') plt.show()

`

**Output:

plot

Simple Plot

2. Swarm Plot

A swarm plot is similar to a strip plot, but points are arranged to avoid overlap. This ensures all data points are visible, making it more informative.

**Applications

**Advantages

**Limitations

sns.set(style="whitegrid") iris = sns.load_dataset("iris") sns.swarmplot(x="species", y="sepal_length", data=iris) plt.title("Swarm Plot of Sepal Length by Species") plt.show()

`

**Output:

swarn

Swarm Plot

3. Bar Plot

A bar plot shows the average (by default mean) of a numerical variable across categories. It can use different estimators (mean, median, std, etc.) for aggregation.

**Applications

**Advantages

**Limitations

tips = sns.load_dataset("tips") sns.barplot(x="sex", y="total_bill", data=tips, palette="plasma") plt.title("Average Total Bill by Gender") plt.show()

`

**Output:

bar-plot

Bar Plot

4. Count Plot

A count plot simply counts the occurrences of each category. It is like a histogram for categorical variables.

**Applications

**Advantages

**Limitations

tips = sns.load_dataset("tips") sns.countplot(x="sex", data=tips) plt.title("Count of Gender in Dataset") plt.show()

`

**Output:

count-plot

Count Plot

5. Box Plot

A box plot (or whisker plot) summarizes numerical data using quartiles, median and outliers. It helps in detecting variability and spread.

**Applications

**Advantages

**Limitations

tips = sns.load_dataset("tips") sns.boxplot(x="day", y="total_bill", data=tips, hue="smoker") plt.title("Total Bill Distribution by Day & Smoking Status") plt.show()

`

**Output:

boxplot

Box Plot

6. Violin Plot

A violin plot combines a box plot with a density plot, showing both summary stats and distribution shape.

**Applications

**Advantages

**Limitations

tips = sns.load_dataset("tips") sns.violinplot(x="day", y="total_bill", data=tips, hue="sex", split=True) plt.title("Violin Plot of Total Bill by Day and Gender") plt.show()

`

**Output:

violin-plot

Violin Plot

7. Strip Plot with Hue

This is an enhanced strip plot where categories are further divided using hue. It allows comparing multiple sub-groups within a category.

**Applications

**Advantages

**Limitations

tips = sns.load_dataset("tips") sns.stripplot(x="day", y="total_bill", data=tips, jitter=True, hue="smoker", dodge=True) plt.title("Total Bill Distribution with Smoking Status") plt.show()

`

**Output:

strip-with-hue

Strip Plot with Hue

Applications