Hello, I create a simple ggplot that only shows a straight line. I then add three datasets of CI using the geom_errorbar function. The problem is that I can't find any way to have the legend showing up ... I need to show what each color of the CIs corresponds to i.e. which method. Can anyone advice please? TIA, Best regards, Giovanni
ggplot2's geom_errorbar legend
4 messages · Giovanni Azua, Ista Zahn, Hadley Wickham
Hi Giovanni, A reproducible example would help. Also, since I think this will be tricky, it might be a good idea to post it to the ggplot2 mailing list (you can register at http://had.co.nz/ggplot2/ ). Best, Ista
On Sat, May 1, 2010 at 1:34 PM, Giovanni Azua <bravegag at gmail.com> wrote:
Hello, I create a simple ggplot that only shows a straight line. I then add three datasets of CI using the geom_errorbar function. The problem is that I can't find any way to have the legend showing up ... I need to show what each ?color of the CIs corresponds to i.e. which method. Can anyone advice please? TIA, Best regards, Giovanni
______________________________________________ R-help at 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.
Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100502/47f057f1/attachment.pl>
3 days later
Hi Giovanni, The basic idea is: classiclimits <- aes(x=x[1:100],ymax = classiccis[1:100,e,p, ymin=classiccis[1:100,e,p,2], colour = "classic") ownlimits <- aes(x=x[1:100]+0.4,ymax = owncis[1:100,e,p,1], ymin=owncis[1:100,e,p,2], colour = "own") rbootlimits <- aes(x=x[1:100]+0.8,ymax = rbootcis[1:100,e,p,1], ymin=rbootcis[1:100,e,p,2], colour = "rboot") And then remove the explicit colours elsewhere in your code. Hadley
Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/