> -----Original Message----- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Luigi > Sent: 14 June 2012 00:44 > To: dcarl...@tamu.edu > Cc: r-help@r-project.org > Subject: Re: [R] Median line with stripchart > > Sorry for the inconvenience, > I have added an EXAMPLE. Here I am plotting few data with the > relative median values. The median are added ad hoc using the > points() function, which is not really professional and is > time consuming. With boxplot() the median values are > automatically drawn, with striplot() this is not true and I > couldn't find another suitable package.
Two things: - you could use segments() to drw the lines - you don't have to plot each point individually Example y <- rnorm(3*17, 11) #some data g <- gl(3, 17) #Generate a grouping factor stripchart(y~g, ylim=c(0.5,3.5)) #leave some space #defaults to unit locations for groups meds <- tapply(y,g,median) #get the medians in factor level order - same order as stripchart loc.strip <- 1:3 segments(meds, loc.strip-0.3, meds, loc.strip+0.3, col=2, lwd=3) #adjust the line length with the 0.3 and the thickness with lwd as usual ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}} ______________________________________________ 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.