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)
Tâche
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.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 3. Chapitre 3
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Suggested prompts:
Résumer ce chapitre
Expliquer le code dans file
Expliquer pourquoi file ne résout pas la tâche
Génial!
Completion taux amélioré à 5.88
Let's Cope with Axes
Glissez pour afficher le menu
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)
Tâche
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.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 3. Chapitre 3
single