Hi, I recommend the use of panel.bwplot.intermediate.hh in the HH package. This is a lattice function. Lattice usually gives you more control than base graphics.
I build your example in several steps here. Critical items to notice: You must declare the months to be ordered; by default they are sorted alphabetically. The position() function in the HH package gives control of the spacing of factor levels in an axis. The default axis labels are overprinting. By displaying only the 2, 5, ... label, and by grouping the three group levels within each month, you get a more readable graph. In your jpg example, there are an excess of outliers. Please be sure to understand what they represent. Rich ## install.packages("HH") ## if needed library(HH) mycolors <- c("lightgreen", "darkgreen", "red") tmp <- data.frame(y=rnorm(612), month=rep(ordered(month.abb, levels=month.abb), 51), group=rep(ordered(mycolors, levels=mycolors), 3, each=17)) gm <- with(tmp, interaction(group, month)) bwplot(y ~ month | group, data=tmp, main="first attempt", layout=c(3,1)) bwplot(y ~ gm, data=tmp, col=mycolors, main="second attempt") bwplot(y ~ gm, data=tmp, col=mycolors, main="third attempt", panel=panel.bwplot.intermediate.hh) bwplot(y ~ gm, data=tmp, col=mycolors, main="fourth attempt", panel=panel.bwplot.intermediate.hh, key=list( text=list(mycolors, col=mycolors), space="right", border=TRUE, title="Group Name",cex.title=.9), scales=list(x=list(at=(3*(1:12)-1), labels=month.abb))) position(gm) <- as.vector(outer(c(-.8,0,.8), (3*(1:12)-1), "+")) bwplot(y ~ gm, data=tmp, col=mycolors, panel=panel.bwplot.intermediate.hh, key=list( text=list(mycolors, col=mycolors), space="right", border=TRUE, title="Group Name",cex.title=.9), scales=list(x=list(at=(3*(1:12)-1), labels=month.abb)), main="fifth: what you asked for") On Wed, Aug 15, 2012 at 8:34 AM, andyspeak <freakyspe...@hotmail.com> wrote: > Hi, im a newbie with very wobbly coding abilities. > Tearing my hair out over getting the boxplot i want... > > I have a dataset called 'eagle' which consists of year (2011 or 2012), > month > (jan - dec), roof (TT6, TT13 or BARE) and temp (the continuous variable > that > i want to plot). > So i want boxplots of the three roof treatments in every month organised in > chronical order along x axis 2011 - 2012. > > my code at the moment is: > > > boxplot(Temp~Month, data=eagle, at = 1:12 - 0.5, boxwex=0.25, subset=Roof > > == "TT6", col = "green") > > boxplot(Temp~Month, data=eagle, add=TRUE, at = 1:12 - 0.1, boxwex = 0.25, > > subset=Roof == "TT13", col = "darkgreen") > > boxplot(Temp~Month, data=eagle, add=TRUE, boxwex=0.25, at = 1:12 + 0.2, > > subset=Roof == "BARE", col = "red") > > smartlegend(x="left",y="top", inset = 0, c("green 1", "green 2", "bare"), > > fill = c("green", "darkgreen", "red")) > > which produces the graph inserted > > Can anyone point me in right direction? > thanks http://r.789695.n4.nabble.com/file/n4640360/boxplot_trial.jpg > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/boxplot-help-tp4640360.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. > [[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.