Thanks for your help Mike, it works like a charm now!! --- On Thu, 5/28/09, Mike Lawrence <mike.lawre...@dal.ca> wrote:
> From: Mike Lawrence <mike.lawre...@dal.ca> > Subject: Re: [R] ggplot2 legend > To: "Felipe Carrillo" <mazatlanmex...@yahoo.com> > Cc: r-h...@stat.math.ethz.ch > Date: Thursday, May 28, 2009, 1:06 PM > First, your example didn't work > because fish_ByMuestreo didn't build > properly (deleting the first "structure(list(data = " bit > solves > this). > > To solve your plotting problem, note that as constructed, > the Muestreo > column is numeric, whereas you seem to want to treat it as > a factor. > Solution: convert to factor: > > fish_ByMuestreo$Muestreo=factor(fish_ByMuestreo$Muestreo) > > On Thu, May 28, 2009 at 3:47 PM, Felipe Carrillo > <mazatlanmex...@yahoo.com> > wrote: > > > > Hi: > > I need some help with the legend. I got 14 > samples(Muestreo) and I > > am trying to plot a smooth line for each sample. I > am able to accomplish that but the problem is that the > legend only displays every other sample. How can I force the > legend to show all of my Muestreos? Thanks in advance. > > library(ggplot2) > > fishplot <- > qplot(PondName,BodyWeight.g.,data=fish_ByMuestreo,colour=Muestreo,position="jitter")+stat_summary(aes(group=Muestreo),fun.data="mean_cl_normal", colour="green",geom="smooth",fill=NA)+ opts(title="Average weight(grs) by Pond") print(fishplot) > > Felipe D. Carrillo > > Supervisory Fishery Biologist > > Department of the Interior > > US Fish & Wildlife Service > > California, USA > Mike Lawrence > Graduate Student > Department of Psychology > Dalhousie University ______________________________________________ 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.