与facet_wrap,自由音阶和coord_flip的ggplot 0.9.3问题

时间:2013-04-22 13:59:21

标签: r ggplot2

示例演示中的这个简单代码在0.9.3中不再起作用。

require(ggplot2)
p <- qplot(displ, hwy, data = mpg)
p + facet_wrap(~ cyl, scales = "free_y") + coord_flip()

上面的代码现在产生错误:

Error in facet_render.wrap(plot$facet, panel, plot$coordinates, plot_theme(plot),  : 
  ggplot2 does not currently support free scales with a non-cartesian coord or coord_flip.

获得类似内容的解决方法有哪些。谢谢!

=============================================== =======第二次尝试

最后来创造一个小例子。这是一种重现方式:

数据集:d.csv:

"Priority","Owner","Project"
"Medium","owner7","Team4"
"Medium","owner1","Team1"
"Low","","Team3"
"High","owner6","Team3"
"Medium","","Team4"
"Medium","owner3","Team1"
"Medium","owner2","Team1"
"Medium","owner5","Team2"
"Low","owner4","Team2"
"Critical","","Team2"
"Medium","owner2","Team1"
"High","","Team4"

代码:

data <- read.csv(file="d.csv",head=TRUE)
attach(data)

p3 <- ggplot(data,aes(x=Owner,fill=Priority))+
geom_bar(aes(y=..count..)) + 
facet_wrap(~ Project, nrow=2, scales="free") +
opts(legend.position="none") 

这会创建一个多面图,但我需要翻转轴。以前,添加coord_flip()可以解决这个问题,但现在新的ggplot不允许一起使用自由缩放和coord_flip。还有其他方法可以转动小平面轴吗?自由秤对我很重要。谢谢你的任何指示。

0 个答案:

没有答案