Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Displot | Distributions of Data
Deep Dive into the seaborn Visualization

book
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.

carousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-img
Завдання

Swipe to start coding

  1. Set the 'darkgrid' style.
  2. Create the displot using the seaborn 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.

Рішення

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
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()

Запитати АІ

expand
ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

some-alt