【发布时间】:2013-01-27 21:20:10
【问题描述】:
我可以用经典的boxplot 做到这一点。这里我们使用内置数据:PlantGrown 为例。
attach(PlantGrowth)
boxplot(weight~group,data=PlantGrowth,xaxt="n")
PlantGrowthSum=ddply(PlantGrowth,.(group),summarise,sum=length(weight))
> PlantGrowthSum
group sum
1 ctrl 10
2 trt1 10
3 trt2 10
axis(1,1:3,paste(PlantGrowthSum$group,"(",PlantGrowthSum$sum,")",sep=""))
这里有个问题,ggplot2 怎么样?
library(ggplot2)
bp <- ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group))
+ geom_boxplot()
+theme(axis.text.x=element_blank())
+theme(axis.text.x=1:3)
bp
但它失败了。关于应该设置哪个参数的任何线索?
【问题讨论】: