Last call! Check what courses we have in our offer, and get them all here to save $727 (only hours left.)
Visualize your data 1
Visualize your data 2
Work with your chart
10. Remove unnecessary elements
Check yourself
Extra

Instruction

Get rid of unneeded elements.

Always check if all the elements on your chart are necessary. Avoiding clutter is a data visualization best practice. In this case, we aren't using the vertical categorical axis. Let's remove all its elements using the theme command.

Exercise

Remove the vertical categorical axis grid, title, text, lines, and ticks. Add (+) the theme() command to the stacked object.

These are the options for vertical axis elements:

  • grid: panel.grid.major.y
  • axis title: axis.title.y
  • axis ticks: axis.ticks.y
  • axis text: axis.text.y
  • axis line: axis.line.y

When you're done, press the Run and Check Code button.

Stuck? Here's a hint!

You should write:

  theme(
    axis.title.y = element_blank(),
    axis.ticks.y = element_blank(),  
    axis.text.y = element_blank(), 
    axis.line.y = element_blank(), 
    panel.grid.major.y = element_blank())