gpt4 book ai didi

旋转 ggplot2 绘图对象

转载 作者:行者123 更新时间:2023-12-04 10:18:08 27 4
gpt4 key购买 nike

我想将一个完整的 ggplot 对象旋转 90°。

我不想使用 coord_flip因为这似乎会干扰 scale="free"space="free"使用刻面时。

例如:

qplot(as.factor(mpg), wt, data=mtcars)+
facet_grid(.~vs + am, scale="free",space="free")

enter image description here

对比
qplot(as.factor(mpg), wt, data=mtcars)+
facet_grid(vs + am ~ ., scale="free",space="free")+
coord_flip()

enter image description here

我想要什么:

enter image description here

我可能需要使用 gridExtra .

最佳答案

print(p, vp=viewport(angle=-90))

关于旋转 ggplot2 绘图对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24312713/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com