I have the following code:
library(tidyverse)
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p + facet_grid(drv ~ .)
Which produces this plot:
As describe above how can I switch right-hand strip to left side and vice versa.
You could use switch
in facet_grid
to change the facet strip to left and scale_y_continuous
to change y-axis to right.
library(ggplot2)
p + facet_grid(drv ~ ., switch = "y") +
scale_y_continuous(position = "right")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With