Sectionย 3. Chapterย 3
single
Let's Cope with Axes
Swipe to show 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)
Task
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
Everything was clear?
Thanks for your feedback!
Sectionย 3. Chapterย 3
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat