有没有办法在ggplot2的特定角度下在主题中设置panel.grid.major?
Is there a way to have panel.grid.major in theme under specific angle in ggplot2?
我想知道是否有办法在 ggplot2 中以特定角度旋转 panel.grid.major.x 行?我在文档中看到它使用 element_line 但它没有 angle
参数对应于 axis.title.x 中的旋转 - 类似于 theme
元素中的函数来自 ggplot2
包的 ggplot
对象来自 R
?
编辑
我想在图上添加额外的线条(如下面的示例所示),但我认为旋转面板网格会更容易,而不是为每条线条添加 geom_abline
。
使用 geom_abline
肯定比尝试更改网格线与坐标的工作方式要容易得多。每条线不需要 geom_abline
,它以向量作为斜率和截距。所以:
ggplot(mtcars, aes(x = disp, y = mpg)) +
geom_point() +
theme_void() +
geom_abline(slope = 2, intercept = 0:10 * 50 - 800, colour = "grey50")
我想知道是否有办法在 ggplot2 中以特定角度旋转 panel.grid.major.x 行?我在文档中看到它使用 element_line 但它没有 angle
参数对应于 axis.title.x 中的旋转 - 类似于 theme
元素中的函数来自 ggplot2
包的 ggplot
对象来自 R
?
编辑
我想在图上添加额外的线条(如下面的示例所示),但我认为旋转面板网格会更容易,而不是为每条线条添加 geom_abline
。
使用 geom_abline
肯定比尝试更改网格线与坐标的工作方式要容易得多。每条线不需要 geom_abline
,它以向量作为斜率和截距。所以:
ggplot(mtcars, aes(x = disp, y = mpg)) +
geom_point() +
theme_void() +
geom_abline(slope = 2, intercept = 0:10 * 50 - 800, colour = "grey50")