Boxplot is a way of visualizing numerical data using quartiles.

Q1 and Q3 quartiles are calculated and are represented as boxes. Along with it, lines are attached to the boxes and these lines are called as whiskers. These whiskers indicate variability outside the upper and lower quartiles. And outside these whiskers, there exists the outliers which are indicated by data points simply.

Box plot is also called as ‘Box and whisker’ plot

Q1 is 25th percentile

Q3 is 75th percentile

IQR = InterQuartile Range = Q3 - Q1 = middle 50% data values

Whisker of a box plot can go down to minimum value (Q1 - 1.5 * IQR) and can go upto maximum value (Q3 + 1.5 * IQR)

Consider that your minimum data point is 13, but after calculating Q1 - 1.5 * IQR, you get the value as 10, but since your minimum data point is 13, hence instead of 10, box plot whisker will be set on 13.

And in other case, consider your minimum data point is 2, but after calculating Q1 - 1.5 * IQR, you get 10, then whisker will be set on 10, and anything which is lesser than 10 will be considered as outliers.

**Code:**

import pandas as pd

import seaborn as sns

import matplotlib.pyplot as plt

df = pd.read_csv("graphical_data.csv")

plt.boxplot(data = df, x = 'Instagram_Followers')

plt.ylabel("Salary", size=20)

plt.yticks(fontsize = 15)

plt.show()

**Output:**

Violin plot is similar to box plot, but additionally it displays probability density function too. In between the violin image, there is a thin line representing a box plot. For the median value, there is one white point in between.

**Code:**

import pandas as pd

import seaborn as sns

import matplotlib.pyplot as plt

df = pd.read_csv("graphical_data.csv")

sns.violinplot(x="Gender", y="Salary", data=df)

plt.ylabel("Salary", size=20)

plt.yticks(fontsize = 15)

plt.xlabel("Gender", size=20)

plt.xticks(fontsize = 15)

plt.show()

**Output:**

Courses | Blogs | Cheat Sheet | News Letter | About Us | Login | Contact | Privacy policy | Cookie policy

© Padhai Time 2022 | All Rights Reserved

We collect cookies and may share with 3rd party vendors for analytics, advertising and to enhance your experience. You can read more about our cookie policy by clicking on the 'Learn More' Button. By Clicking 'Accept', you agree to use our cookie technology.

Our Privacy policy can be found by clicking here