Let's Cope with Axes
Setting label names:
To set label names, we need to set a plot variable and use:
# g is the plot variable.
g.set(xlabel = 'x_name', ylabel = 'y_name')
X(y)ticks rotation:
To rotate labels, we need to use:
# n is the angle
plt.xticks(rotation = n)
plt.yticks(rotation = n)
Tehtävä
Swipe to start coding
- Import
seabornwithsnsalias. - Import
matplotlib.pyplotwithpltalias. - Import
pandaswithpdalias. - Set label names
'Population'(Oy axis) &'Years(2012-2022)'(Ox axis). - Rotate labels along the Ox axis by 45 degrees.
- Show the plot.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 3. Luku 3
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Mahtavaa!
Completion arvosana parantunut arvoon 5.88
Let's Cope with Axes
Pyyhkäise näyttääksesi valikon
Setting label names:
To set label names, we need to set a plot variable and use:
# g is the plot variable.
g.set(xlabel = 'x_name', ylabel = 'y_name')
X(y)ticks rotation:
To rotate labels, we need to use:
# n is the angle
plt.xticks(rotation = n)
plt.yticks(rotation = n)
Tehtävä
Swipe to start coding
- Import
seabornwithsnsalias. - Import
matplotlib.pyplotwithpltalias. - Import
pandaswithpdalias. - Set label names
'Population'(Oy axis) &'Years(2012-2022)'(Ox axis). - Rotate labels along the Ox axis by 45 degrees.
- Show the plot.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 3. Luku 3
single