分别在ggplot2中设置边距

时间:2019-04-16 07:55:45

标签: r ggplot2

我正在尝试创建一种ggplot2样式,其中titlesubtitleaxis.text.y在图上不在y上都与0边距对齐轴。

然后我想在axis.text.ypanel.grid之间留出不同的边距,例如64px。

这可以在theme()函数中完成吗?

library(ggplot2)
library(magrittr)

iris %>%
  ggplot(aes(Sepal.Length, Sepal.Width,
             color = Species)) +
  geom_point() +
  theme_minimal() +
  theme(legend.position = 0) +
  labs(title = "The Sepal.Width vs. Sepeal.Length",
       subtitle = "The iris dataset",
       y = "") 

所需结果:

enter image description here

0 个答案:

没有答案
相关问题