我试图在GGPlot的水平条形图中针对美国各州绘制一些值。
代码是:
g <- df %>%
select(Sample.Measurement, State.Name) %>%
group_by(State.Name) %>%
count() %>%
arrange(n) %>%
ggplot(., mapping = aes(x=reorder(State.Name, n), y =n))+
geom_bar(stat = "identity", width=.8, position = position_dodge(width = .25))+
labs(
title = "",
y= "Frequency"
)+
coord_flip()
g+theme(axis.text=element_text(size=20),
axis.title=element_text(size=30,face="bold"))
主题元素是为了更改文本大小。
我真正想做的是扩展图表的深度,以便各个州拥有更多空间。我怎么做?
编辑块选项,即fig.height
和fig.width
。
例如
```{r fig.height = 10, fig.width = 5}
#your plot code
```
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句