旋转ggplot2图形对象 [英] Rotate a ggplot2 plot object
本文介绍了旋转ggplot2图形对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想旋转一个完整的ggplot对象90°。
我不想使用 coord_flip
因为这在使用facets时似乎会干扰 scale =free
和 space =free
。
例如:
qplot(as.factor(mpg),wt, data = mtcars)+
facet_grid(。〜vs + am,scale =free,space =free)
vs
qplot(as.factor(mpg),wt,data = mtcars)+
facet_grid( vs + am〜。,scale =free,space =free)+
coord_flip()
我想要什么:
我可能需要使用 gridExtra
。
I would like to rotate a complete ggplot object 90°.
I do not wish to use coord_flip
as this appears to interfere with scale="free"
and space="free"
when using facets.
For example:
qplot(as.factor(mpg), wt, data=mtcars)+
facet_grid(.~vs + am, scale="free",space="free")
vs
qplot(as.factor(mpg), wt, data=mtcars)+
facet_grid(vs + am ~ ., scale="free",space="free")+
coord_flip()
What I would like:
I would likely need to use gridExtra
.
解决方案
print(p, vp=viewport(angle=-90))
这篇关于旋转ggplot2图形对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文