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

book
Rugplot

The rugplot is intended to complement other plots by showing the location of individual observations in an unobtrusive way.

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

Swipe to start coding

  1. Set the 'darkgrid' style with the disabled 'axes.grid' and the 'axes.facecolor' equals the 'aliceblue' (color). We learned how to do that in the first part of the course.
  2. Create the kdeplot using the seaborn library.
  3. Create the rugplot using the seaborn library:
  • Set the x parameter equals the 'total_bill';
  • Set the hue parameter equals the 'sex';
  • Set the height parameter equals 0.05;
  • Set the 'magma' palette;
  • Set the data using the df;
  • Display the plot.

Рішення

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/tips.csv')

# Set the 'darkgrid' style
sns.set_style('darkgrid',
# Disable the axes.grid
{'axes.grid' : False,
# Set the 'aliceblue' facecolor
'axes.facecolor' : 'aliceblue'})
# Create a kdeplot
sns.kdeplot(x = 'total_bill',
hue = 'sex',
palette = 'magma',
multiple = 'layer',
fill = True,
data = df)

# Create a rugplot
sns.rugplot(# Set the x
x = 'total_bill',
# Set the hue
hue = 'sex',
# Set the height
height = 0.05,
# Set the palette
palette = 'magma',

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 3
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/tips.csv')

# Set the 'darkgrid' style
sns.set_style('___',
# Disable the axes.grid
{'axes.___ ' : ___,
# Set the 'aliceblue' facecolor
'___.facecolor' : '___'})
# Create a kdeplot
sns.___(x = 'total_bill',
hue = 'sex',
palette = 'magma',
multiple = 'layer',
fill = True,
data = df)

# Create a rugplot
sns.___(# Set the x
___,
# Set the hue
___,
# Set the height
height = ___,
# Set the palette
___,

Запитати АІ

expand
ChatGPT

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

some-alt