问题:我找不到任何方法在ggplot2. y 轴应始终包含 0-40 和 的范围breaks=c(5,10,15,20,25,30,35)。x轴应该是0-100, breaks=c(10,20,30,40,50,60,70,80,90,100)。我不想显示超出此范围的数据。
我试过+ ylim,但这会覆盖我的休息时间。我试过了+ expand,但这也显示了我想要的范围之外的数据(1-100)。我尝试在第二步中添加中断和限制范围,但如果我这样做,我第一步的 y 轴会被简单地覆盖。
plot_Tili_Age_VS_Height <- ggplot(Tili, aes(x = Age, y = Height)) + geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "black", formula = y ~ x) +
scale_y_continuous(trans = "log10", breaks = c(5, 10, 15, 20, 25, 30, 35)) +
expand_limits(y = c(0, 35), x = c(0, 100)) +
scale_x_continuous(trans = "log10", breaks = c(10, 20, 30, 40, …Run Code Online (Sandbox Code Playgroud)