我希望标题不被切掉,并从我用来自cowplot的plot_grid生成的图表中删除轴标签。
这是我的代码
data(mtcars)
library(ggplot2)
library(cowplot)
mpg = ggplot() +
geom_boxplot(aes(y = mpg,x = as.factor(cyl)),data=mtcars) +
coord_flip()
am=ggplot() +
geom_boxplot(aes(y = mpg,x = as.factor(am)),data=mtcars) +
coord_flip()
vs=ggplot() +
geom_boxplot(aes(y = mpg,x = as.factor(vs)),data=mtcars) +
coord_flip()
gear = ggplot() +
geom_boxplot(aes(y = mpg,x = as.factor(gear)),data=mtcars) +
coord_flip()
p=plot_grid(mpg,am,vs,gear, labels = "Variables effecting Mileage", label_size = 14, hjust = -0.5,
+ vjust = 0.5)+theme_grey()
p
另外,如果在没有cowplot的情况下创建它会更简单,你有什么建议?