Get a third axis on the right side

Is there a way to get a third axis on the right side of the diagram? (like mirroring the y axis)

Check out ggplot2::sec_axis().

library(ggplot2)

ggplot(mtcars, 
       aes(x = factor(cyl), y = mpg)) +
  geom_boxplot() +
  scale_y_continuous(
    sec.axis = sec_axis(~.x, name = "mpg")
  )

Created on 2022-05-30 by the reprex package (v2.0.1)

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.