Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
Visualize your data - line chart
Work with your chart
8. Changing the baseline
Check yourself


We can keep zero as a baseline in our chart – there's not too much empty space, and in this case it is a logical starting point.

To do this, we will add the function scale_y_continuous() to our plot. This function determines features on the vertical axis. We will use two arguments to get what we want:

  • expand = c(0,0) – Forces the axis to start at zero,
  • limits = c(0,8) – Sets its range from 0 to 8


Add scale_y_continuous() with those two arguments to our line object.

Stuck? Here's a hint!

You should write:

scale_y_continuous(expand = c(0, 0), limits = c(0, 8))