Thanks for your help Mike, it works like a charm now!!
--- On Thu, 5/28/09, Mike Lawrence <Mike.Lawrence at dal.ca> wrote:
From: Mike Lawrence <Mike.Lawrence at dal.ca> Subject: Re: [R] ggplot2 legend To: "Felipe Carrillo" <mazatlanmexico at yahoo.com> Cc: r-help at 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 <mazatlanmexico at 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