首页 > 解决方案 > 将情节编织成文字,情节的大小被压扁

问题描述

我正在尝试创建 4 个条形图,这些条形图仅显示按各种人口统计数据划分的响应数量。

因此我有以下代码块

{r, echo = FALSE, fig.height=20, fig.width=40}  <-this is has the proper start but stackoverflow wont let me post it

a <- ggplot(data=Data, aes(x=Gender, fill=Gender))+
  geom_bar(stat="count")+
  scale_x_discrete(labels = wrap_format(10))+
  ylab("Number of respondents")
b <- ggplot(data=Data, aes(x=Condition, fill=Condition))+
  geom_bar(stat="count")+
  scale_x_discrete(labels = wrap_format(10))+
  ylab("Number of respondents")+
  xlab("Employment type")
c <- ggplot(data=Data, aes(x=Schedule, fill=Schedule))+
  geom_bar(stat="count")+
  scale_x_discrete(labels = wrap_format(10))+
  ylab("Number of respondents")

d <- ggplot(data=Data, aes(x=Region, fill=Region))+
  geom_bar(stat="count")+
  scale_x_discrete(labels = wrap_format(10))+
  ylab("Number of respondents")

plot_grid(a,b,c,d)

这以一个漂亮的网格呈现了这些图。然而,除非放大很多,否则这些图表非常小。

然而,弄乱 fig.height 和 fig.width 要么使图变得非常小或大,但是每个图中的所有数据都被压扁了。

如何在保持可读性的同时简单地调整图形的大小?

标签: rr-markdown

解决方案


推荐阅读