在ggpaired()或ggpar()中使用coord_cartesian()函数来设置坐标轴的限制。例如:
library(ggpubr)
data("ToothGrowth")
# ggpaired()示例
ggpaired(ToothGrowth, x = "dose", y = "len", group = "supp",
line.color = "supp", palette = "jco") +
labs(title = "Tooth Growth") +
scale_x_continuous(limits = c(0, 2), breaks = c(0, 1, 2)) +
coord_cartesian(xlim = c(0, 2))
# ggpar()示例
ggpar(ggboxplot(ToothGrowth, x = "supp", y = "len"),
ylim = c(0, 35), ggtheme = theme_bw())