Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 从两个图重新调整一个图_R - Fatal编程技术网

R 从两个图重新调整一个图

R 从两个图重新调整一个图,r,R,我在同一个图表中有两个图。我需要调整第一个图,使y轴与案例数量有关,而案例数量低于第二个图。就目前而言,第一个情节很难阅读,因为它比第二个情节小得多。我希望它是成比例的 all.scores = rbind(UK_Together.scores, YesScotland.scores) ggplot(data=all.scores) + # ggplot works on data.frames, always geom_bar(mapping=aes(x=score, fill=Par

我在同一个图表中有两个图。我需要调整第一个图,使y轴与案例数量有关,而案例数量低于第二个图。就目前而言,第一个情节很难阅读,因为它比第二个情节小得多。我希望它是成比例的

 all.scores = rbind(UK_Together.scores, YesScotland.scores)
 ggplot(data=all.scores) + # ggplot works on data.frames, always
  geom_bar(mapping=aes(x=score, fill=Parti), binwidth=1) +
  facet_grid(Parti~.) + # make a separate plot for each hashtag
  theme_bw() + scale_fill_brewer() # plain display, nicer colors

有人可以帮忙吗?

您能提供一个小示例数据集吗?例如,headall.scores。我想你想要facet\u gridParti~,scales=free\u y?这在概念上很容易思考,但在实践中很难做到。您可以做的是在scale_x_discrete中为绘图打断和标签修复x轴,或者启用/禁用图例、标题。。。等,并尝试使用grid.arrange in gridExtra软件包对齐两个绘图。另一个选项是将所有数据合并到单个data.frame中,并使用现有的facet_wrap或facet_grid函数进行绘图。