R ggplot2 facet_grid的问题 [英] R ggplot2 facet_grid question

查看:143
本文介绍了R ggplot2 facet_grid的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ggplot2情节,看起来像这样:



alt text http://img69.imageshack.us/img69/9704/plot.png



来自以下R代码:

  ggplot(newdata,aes(benefit,cost,color = factor(opt),shape = factor(roster))) 

+ facet_grid(。〜location)

正是我所需要的,除非图表太宽而无法清晰读取。



我希望能够将最右边的四个位置放在最左边的四个位置,这样散点图就像这样排序。


 阿德莱德布里斯班凯恩斯堪培拉

达尔文霍巴特墨尔本悉尼

我可以使用facet_grid()来做到这一点吗?或者我应该创建两个图并将它们排列在GIMP中?



关于 facet_grid()似乎并不表示可能。



感谢您的帮助: - )

解决方案

您可以尝试

  facet_wrap(〜location,ncol = 4)


I have a ggplot2 plot that looks like this:

alt text http://img69.imageshack.us/img69/9704/plot.png

from the following R code:

ggplot(newdata, aes(benefit, cost, colour = factor(opt), shape = factor(roster)))

+ facet_grid(. ~ location)

It's exactly what I need, except that the graph is too wide to be clearly read.

I'd like to be able to take the four rightmost locations and place them under the four leftmost, such that the scatter plots are ordered like this.

Adelaide   Brisbane   Cairns      Canberra

Darwin     Hobart     Melbourne   Sydney

Can I do this with facet_grid()? Or should I just create two plots and line them up in GIMP?

The documentation on facet_grid() doesn't seem to indicate that it's possible.

Thanks for the help :-)

解决方案

You could try

facet_wrap( ~ location, ncol = 4)

这篇关于R ggplot2 facet_grid的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆