TEMP %>% ggplot(aes(x= Count,y=reorder(Species,Count))) + geom_col(position = "dodge") + ggtitle("Insects abundance during 2017~2019") + ylab("Insects") + xlab("Mean Number") + facet_wrap(~ CLASS,ncol = 1,scales = 'free') + theme_bw()
我想让顶部面板和底部面板具有相同的宽度条。但即使我在geom_col(width = .5)
. 它们仍然是不同的宽度。有什么问题。感谢所有关心我问题的人。谢谢。
由于您没有发布带有数据的 reprex,我将只使用 mtcars 数据集。
的space
在参数facet_grid()
允许每个面的宽度由x或y值的数量来确定。
没有space = "free_y"
:
library(tidyverse)
mtcars %>% ggplot(aes(y = factor(carb))) +
geom_bar(width = 0.5) +
facet_grid(am~., scales = "free")
与space = "free_y"
:
library(tidyverse)
mtcars %>% ggplot(aes(y = factor(carb))) +
geom_bar(width = 0.5) +
facet_grid(am~., scales = "free", space = "free_y")
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句