Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Know your data
Visualize your data – categorical variables
Work with your chart 2
15. Removing the horizontal grid
Check yourself 2


Improve chart aesthetics by removing redundant grids.

Once again, we find ourselves with an unneeded grid: the horizontal axis grid. It isn't adding anything to the plot; it's just cluttering it up. Let's cut the clutter.

We will do this by adding the theme() command and setting the arguments for panel.grid.major.x and panel.grid.minor.x to blanks. Here's how it looks in code:

theme(panel.grid.major.x = element_blank(), panel.grid.minor.x = element_blank())


Remove the horizontal axis grid, as shown above.

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

Stuck? Here's a hint!

You should write:

  panel.grid.major.x = element_blank(), 
  panel.grid.minor.x = element_blank())