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.











Aufgabe
Swipe to start coding
- Set the
'ticks'
style with the'azure'
axes.facecolor
. - Create the
pointplot
using theseaborn
library and theg
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 theTrue
; - Set the
capsize
parameter equals0.2
; - Set the next
linestyles
:'-'
&'- -'
; - Set the data;
- Display the plot.
Lösung
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
36
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?
Danke für Ihr Feedback!
Abschnitt 3. Kapitel 6
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
36
37
38
39
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
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen