我希望顶部的灰色条更宽,例如,其边缘距离字母的顶部和底部稍远一些(strip.text - A、B、C 等)。我本以为行高会起到填充的作用,但事实并非如此。
ggplot(diamonds, aes(carat, price, fill = ..density..)) +
xlim(0, 2) + stat_binhex(na.rm = TRUE)+
facet_wrap(~ color) +
theme(strip.text = element_text(lineheight=20))
首先,修改级别,使其包含换行符:
levels(diamonds$color) <- paste0(" \n", levels(diamonds$color) , "\n ")
然后根据需要进行调整。例如:
P <- ggplot(diamonds, aes(carat, price, fill = ..density..)) +
xlim(0, 2) + stat_binhex(na.rm = TRUE)+
facet_wrap(~ color)
P + theme(strip.text = element_text(size=9, lineheight=0.5))
P + theme(strip.text = element_text(size=9, lineheight=3.0))
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)