【发布时间】:2021-12-16 15:05:28
【问题描述】:
我正在尝试从三个单独的图制作多面板图(参见图片)。但是,当图采用多面板格式时,我无法纠正成束的 x 轴刻度标签。以下是单个绘图和多面板的脚本:
个人情节:
NewDat [[60]]
EstRes <- NewDat [[60]]
EstResPlt = ggplot(EstRes,aes(Distance3, `newBa`))+geom_line() + scale_x_continuous(n.breaks = 10, limits = c(0, 3500))+ scale_y_continuous(n.breaks = 10, limits = c(0,25))+ xlab("Distance from Core (μm)") + ylab("Ba:Ca concentration(μmol:mol)") + geom_hline(yintercept=2.25, linetype="dashed", color = "red")+ geom_vline(xintercept = 1193.9, linetype="dashed", color = "grey")+ geom_vline(xintercept = 1965.5, linetype="dashed", color = "grey") + geom_vline(xintercept = 2616.9, linetype="dashed", color = "grey") + geom_vline(xintercept = 3202.8, linetype="dashed", color = "grey")+ geom_vline(xintercept = 3698.9, linetype="dashed", color = "grey")
EstResPlt
多面板图:
MultiP <- grid.arrange(MigrPlt,OcResPlt,EstResPlt, nrow =1)
我已尝试包括:
MultiP <- grid.arrange(MigrPlt,OcResPlt,EstResPlt, nrow =1)+
theme(axis.text.x = element_text (angle = 45)) )
MultiP
但只收到错误。不必包含所有刻度线。初始值、中间值和最终值就足够了,因此它们不需要全部包含或倾斜。我只是不确定该怎么做。非常感谢您的帮助。
【问题讨论】:
-
如果该代码正是您使用的,那么末尾的
)是不必要的拼写错误。此外,您可以在使用grid.arrange之前手动旋转每个点。 -
感谢您的回复。额外的 ) 是一个错字,一旦删除就没有效果。您将使用什么脚本手动旋转每个点?我试过这个没有用:``` MultiP
标签: r ggplot2 axis-labels