Boxplot
A boxplot
is a standardized way of displaying the distribution of data based on a five-number summary (minimum, first quartile (Q1), median, third quartile (Q3), and maximum).
It can tell you about your outliers and what their values are. It can also tell you if your data is symmetrical, how tightly your data is grouped, and if and how your data is skewed.









Task
Swipe to start coding
- Set the
'ticks'
style with the'grey'
figure.facecolor
and'white'
x-
&yticks
. - Create the
boxplot
using theseaborn
library:
- Set the
x
parameter equals the'distance'
; - Set the
y
parameter equals the'method'
; - Set the
linewidth
parameter equals2
; - Set the
saturation
parameter equals0.4
; - Set the
'vlag'
palette.
Solution
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import warnings
# Ignore all warnings
warnings.filterwarnings('ignore')
# Importing libraries needed
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# Reading the file
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/66ba0c8e-8422-413c-b7e1-74bd24c61656/planets.csv')
# Set the 'ticks' style with the 'white' x & y ticks and 'grey' facecolor
sns.set_style('ticks', {'xtick.color' : 'white',
'ytick.color' : 'white',
'figure.facecolor' : 'grey'})
# Create a boxplot
sns.boxplot(# Set the x
x = 'distance',
# Set the y
y = 'method',
# Setting the width
width = 0.6,
# Set the linewidth
linewidth = 2,
# Set the saturation
saturation = 0.4,
# Set the palette
palette = 'vlag',
# Setting the data
data = df)
# Displaying the plot
plt.show()
Everything was clear?
Thanks for your feedback!
Section 3. Chapter 3
single
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import warnings
# Ignore all warnings
warnings.filterwarnings('ignore')
# Importing libraries needed
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# Reading the file
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/66ba0c8e-8422-413c-b7e1-74bd24c61656/planets.csv')
# Set the 'ticks' style with the 'white' x & y ticks and 'grey' facecolor
___.___('___', {'xtick.color' : '___',
'___.___' : '___',
'___' : '___'})
# Create a boxplot
___(# Set the x
x = '___',
# Set the y
y = '___',
# Setting the width
width = 0.6,
# Set the linewidth
___,
# Set the saturation
___ = 0.4,
# Set the palette
___,
# Setting the data
data = df)
# Displaying the plot
plt.show()
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat