> It's too obvious, so I am positive that there is a good reason for not doing > this, but still: > why is it not possible, to have an "outlier" output in stat_boxplot that can > be used at geom_text()? > > Something like this, with "upper": > > dat=data.frame(num=rep(1,20), val=c(runif(18),3,3.5), > name=letters[1:20]) > > ggplot(dat, aes(y=val, x=num))+stat_boxplot(outlier.size=4, > + outlier.colour="green")+geom_text(aes(y=..upper..), label="This is upper > hinge") > > Unfortunately, this does not work and gives the error message: > Error in eval(expr, envir, enclos) : object "upper" not found > > Is it because you can only use stat outputs within the stat statements? > Could it be possible to make them available outside the statements too?
You can generally, but it won't work here. The problem is that you want a different y aesthetic for the statistic (val) than you do for the geom (upper) and there's no way to get around that with the current design of ggplot2. Hadley -- http://had.co.nz/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.