Ask on the ggplot mailing list? Normally you use melted data (see the reshape2 package) and let the scales feature build the legend for you. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity.
jcrosbie <ja...@crosb.ie> wrote: > >How to I go about adding a legend to the following plot? > >ggplot() + geom_line(aes(x=df2010$Price,y=df2010$percentCapacity), >colour = >"red") >+ geom_line(aes(x=df2011$Price,y=df2011$percentCapacity), colour = >"green") >+geom_line(aes(x=df2012$Price,y=df2012$percentCapacity), colour = >"blue") >+scale_x_log10() > > ><http://r.789695.n4.nabble.com/file/n4653389/Rplot01.jpeg> > > > >-- >View this message in context: >http://r.789695.n4.nabble.com/ggplot-add-a-legend-tp4653389.html >Sent from the R help mailing list archive at Nabble.com. > >______________________________________________ >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. ______________________________________________ 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.