I am wondering if there is a way to rotate panel.grid.major.x lines under specific angle in ggplot2? I've seen in the documentation that it uses element_line but it does not have an angle
parameter which corresponds to the rotation in axis.title.x-like functions in the theme
element of the ggplot
object from ggplot2
package from R
?
EDIT
I would like to have additional lines on the plot (as in the attached example below) but instead of adding geom_abline
for each line I thought it would be easier to rotate the panel grid.
It's definitely going to be much much easier to use geom_abline
than to try to change the way gridlines work with coordinates. You don't need one geom_abline
for each line, it takes vectors as slope and intercept. So:
ggplot(mtcars, aes(x = disp, y = mpg)) +
geom_point() +
theme_void() +
geom_abline(slope = 2, intercept = 0:10 * 50 - 800, colour = "grey50")
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