tags:

views:

66

answers:

1

I saw http://stackoverflow.com/questions/2492947/boxplot-in-r-showing-the-mean

I'm interested in the ggplot solution. But what I am plotting are averages already so I don't want to do an average of an average. I do have the true mean stored in TrueAvgCPC.

Here is what I tried, but it's not working:

p <- qplot(Mydf$Network,Mydf$Avg.CPC,data=Mydf,geom='boxplot')
p <- p+stat_summary(TrueAvgCPC,shape=1,col='red',geom='point')
print(p)

Thanks!

+1  A: 

As far as I see, you want to just add a true mean (or several?) to the box plot. If you have the value(s), why use stat_summary instead of just plotting the points?

#sample data
x <- rnorm(30)
y <- rep(letters[1:3],10)
TrueAVGCPC <- c(0.34,0.1,0.44)

#plot
p <- qplot(y,x,geom='boxplot')
p <- p+geom_point(aes(x=c(1,2,3),y=TrueAVGCPC),col="red")
print(p)
Joris Meys
thanks!!!!!!!!!
datayoda