Thank you! This worked beautifully. Can you help me adapt the code to do the same thing for a plot of means? The application is not a simple as I hoped...
plotMeans(rich.small$ALL, rich.small$sample, error.bars="se") On Mon, Sep 23, 2013 at 10:41 PM, Jim Lemon <j...@bitwrit.com.au> wrote: > On 09/24/2013 10:05 AM, Sagan Friant wrote: > >> Dear R community, >> >> Please help. I am new(ish) to R and have spent too many hours trying to >> achieve what I believe should be a relatively simple task. I have >> searched >> help forums, but have not been able to successfully apply responses to >> loosely related questions to my own. >> >> I am running some preliminary summary statistics. I wish to create a >> boxplot graph that represents summaries of samples collected over a series >> of time points (0-18). My sample collection intensity was highest early >> on, with samples collection decreasing in frequency over time. I am >> trying >> to scale the the x-axis to unequal intervals. >> >> The code I used for a graph representing a subset of my sample (re-named) >> is below: >> >> Boxplot(ALL~sample, data=rich.small, id.method="n", las = 2, names = >> c("0","2","4","7","10","18")) >> >> There were 10days between samples 0&2 and 3 days between 2&4, 4&7, 7&10, >> and then 75days between 10&18 >> >> Hi Sagan, > I think what you want is to have the boxplots spaced out as the occasions > of measurement: > > rich.small<-data.frame(ALL=**rnorm(240,5), > sample=c(rep(0,60),rep(2,50),**rep(4,40), > rep(7,30),rep(10,30),rep(18,**30))) > # this gives you the spacing with the occasion labels > boxplot(ALL~sample,rich.small,**at=c(0,10,13,16,19,94),xaxt="**n", > xlab="Occasion") > library(plotrix) > staxlab(1,at=c(0,10,13,16,19,**94),labels=c(0,2,4,7,10,18)) > # and this gives you the days > boxplot(ALL~sample,rich.small,**at=c(0,10,13,16,19,94),xaxt="**n", > xlab="Days") > staxlab(1,at=c(0,10,13,16,19,**94)) > > Lots of space in the middle for something. > > Jim > -- Sagan C. Friant, MSc Environment & Resources Ph.D Program Nelson Institute of Environmental Studies University of Wisconsin - Madison [[alternative HTML version deleted]] ______________________________________________ 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.