私はクラシックでそれを行うことができますboxplot
。ここでは組み込みの data: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
しかし、それは失敗しました。どのパラメーターを設定する必要があるかについての手がかりはありますか?