0

I want to make a ggplot with 2 y-axes and control both y axes scales. I found this:

ggplot with 2 y axes on each side and different scales

ggplot(mpg, aes(displ, hwy)) + 
  geom_point() + 
  scale_y_continuous(
    "mpg (US)", 
    sec.axis = sec_axis(~ . * 1.20, name = "mpg (UK)")
  )

enter image description here

I would like to control the left y-axes to limits between -20 and 110 (just an example)

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213

0 Answers0