Displot
Note
displot
=FacetGrid
(we will study this plot later) +histplot
/kdeplot
/ecdfplot
The displot
provides access to several approaches for visualizing the univariate or bivariate distribution of data, including subsets of data defined by semantic mapping and faceting across multiple subplots.
The kind parameter selects the approach to use: histplot
, kdeplot
, ecdfplot
.










Завдання
Swipe to start coding
- Set the
'darkgrid'
style. - Create the
displot
using theseaborn
library:
- Set the
x
parameter equals the'carat'
; - Set the
hue
parameter equals the'cut'
; - Set the
col
parameter equals the'color'
; - Set the
kind
parameter equals the'kde'
; - Set the
multiple
parameter equals the'fill'
; - Set the
palette
equals the'viridis'
; - Set the data.
Рішення
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
import warnings
# Ignore all warnings
warnings.filterwarnings('ignore')
# Importing libraries needed
import seaborn as sns
import pandas as pd
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/diamonds.csv')
# Set the 'darkgrid' style
sns.set_style('darkgrid')
# Create a displot
sns.displot(# Set the x
x = 'carat',
# Set the hue
hue = 'cut',
# Set the col
col = 'color',
# Set the kind
kind = 'kde',
# Set the multiple
multiple = 'fill',
# Set the palette
palette = 'viridis',
# Set the data
data = df)
# Displaying the plot
plt.show()
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 2. Розділ 6
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
import warnings
# Ignore all warnings
warnings.filterwarnings('ignore')
# Importing libraries needed
import seaborn as sns
import pandas as pd
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/diamonds.csv')
# Set the 'darkgrid' style
___.___('___')
# Create a displot
___(# Set the x
___,
# Set the hue
hue = '___',
# Set the col
col = '___',
# Set the kind
___ = 'kde',
# Set the multiple
___,
# Set the palette
palette = '___',
# Set the data
___ = df)
# Displaying the plot
plt.show()
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат