Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Let's Cope with Axes | Plot Customization
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
First Dive into seaborn Visualization

bookLet'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)
Task

Swipe to start coding

  1. Import seaborn with sns alias.
  2. Import matplotlib.pyplot with plt alias.
  3. Import pandas with pd alias.
  4. Set label names 'Population'(Oy axis) & 'Years(2012-2022)'(Ox axis).
  5. Rotate labels along the Ox axis by 45 degrees.
  6. Show the plot.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Summarize this chapter

Explain the code in file

Explain why file doesn't solve the task

close

bookLet'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

  1. Import seaborn with sns alias.
  2. Import matplotlib.pyplot with plt alias.
  3. Import pandas with pd alias.
  4. Set label names 'Population'(Oy axis) & 'Years(2012-2022)'(Ox axis).
  5. Rotate labels along the Ox axis by 45 degrees.
  6. Show the plot.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3
single

single

some-alt