我使用了以下ggplot
命令:
ggplot(survey, aes(x = age)) + stat_bin(aes(n = nrow(h3), y = ..count.. / n), binwidth = 10)
+ scale_y_continuous(formatter = "percent", breaks = c(0, 0.1, 0.2))
+ facet_grid(hospital ~ .)
+ theme(panel.background = theme_blank())
生产
不过,我想把facet个标签改短一些(比如Hosp 1
、Hosp 2
…)因为它们现在太长了,看起来很拥挤(增加图形的高度不是一个选项,它会占用文档中太多的空间).我看了facet_grid帮助页面,但不知道如何.