Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Pointplot | Categorical Plot Types
Deep Dive into the seaborn Visualization

book
Pointplot

A pointplot represents an estimate of the central tendency for a numeric variable by the position of scatter plot points and provides some indication of the uncertainty around that estimate using error bars.

carousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-img
Aufgabe

Swipe to start coding

  1. Set the 'ticks' style with the 'azure' axes.facecolor.
  2. Create the pointplot using the seaborn library and the g variable:
  • Set the x parameter equals the 'day';
  • Set the y parameter equals the 'tip';
  • Set the hue parameter equals the 'sex';
  • Set 'v' & 'o' markers;
  • Set the 'rocket' palette;
  • Set the dodge parameter equals the True;
  • Set the capsize parameter equals 0.2;
  • Set the next linestyles: '-' & '- -';
  • Set the data;
  • Display the plot.

Lösung

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 'ticks' style with the 'azure' facecolor
sns.set_style('ticks', {'axes.facecolor' : 'azure'})
# Create a pointplot using the g variable
g = sns.pointplot(# Set the x
x = 'day',
# Set the y
y = 'tip',
# Set the hue
hue = 'sex',
# Set the markers
markers = ['v', 'o'],
# Set the palette
palette = 'rocket',
# Set the dodge
dodge = True,
# Set the capsize
capsize = 0.2,
# Set the linestyles
linestyles = ['-', '--'],
# Set the data
data = df)

# Setting the title

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 6
single

single

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 'ticks' style with the 'azure' facecolor
___('___', {'___' : '___'})
# Create a pointplot using the g variable
___(# Set the x
x = '___',
# Set the y
___,
# Set the hue
___ = 'sex',
# Set the markers
___ = ['v', '___'],
# Set the palette
___,
# Set the dodge
___,
# Set the capsize
___ = 0.2,
# Set the linestyles
___ = ['-', '--'],
# Set the data
___)

# Setting the title
g.set_title('Tips pointplot')
# Display the plot
___

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

some-alt