R 如何动态调整y轴范围是ggplot2?
如何调整y轴,以便注释也能正确显示在此类绘图中R 如何动态调整y轴范围是ggplot2?,r,ggplot2,R,Ggplot2,如何调整y轴,以便注释也能正确显示在此类绘图中 library(ggplot2) ggplot(diamonds, aes(x = cut, y = depth)) + facet_wrap(~ color) + stat_summary(fun.y = sum, geom="bar", fill = "yellow", aes(label=cut, vjust = 0)) + stat_summary(fun.y = sum, geom="text", aes(label=cut
library(ggplot2)
ggplot(diamonds, aes(x = cut, y = depth)) +
facet_wrap(~ color) +
stat_summary(fun.y = sum, geom="bar", fill = "yellow", aes(label=cut, vjust = 0)) +
stat_summary(fun.y = sum, geom="text", aes(label=cut), vjust = 0)
现在,例如在facet G中,“理想”的注释没有正确显示。应动态计算Y轴范围,以便在条形图上方始终有一些注释空间。因此,我不能使用固定的y轴范围。在现有代码之后使用
+scale\u y\u continuous(expand=c(0.15,0))
如何:
expand=
需要一个2位数的乘性和加性比例因子向量