Is there a way to have panel.grid.major in the subject at a specific angle in ggplot2?

I am wondering if there is a way to rotate the panel.grid.major.x panels at a certain angle in ggplot2? I saw in the documentation that it uses element_line , but it does not have an angle parameter that corresponds to the rotation .title.x-like in the theme element of the ggplot object from the ggplot2 package from R ?

EDIT

I would like to have additional lines on the graph (as in the example below), but instead of adding geom_abline for each line, I thought it would be easier to rotate the panel grid. enter image description here

+5
source share
1 answer

Most likely, using geom_abline much easier than trying to change the way the grid works with coordinates. For each line you do not need one geom_abline , it accepts vectors as slope and interception. So:

 ggplot(mtcars, aes(x = disp, y = mpg)) + geom_point() + theme_void() + geom_abline(slope = 2, intercept = 0:10 * 50 - 800, colour = "grey50") 

enter image description here

+1
source

Source: https://habr.com/ru/post/1234711/


All Articles