On Tue, Oct 19, 2010 at 4:18 PM, Alexandr Malusek <alexandr.malu...@gmail.com> wrote: > Hi, > > The behavior of panel.average has changed. In March 2010, I plotted > the attached r_plotViolinOfAnnualE_old.eps. (I don't know the version > of R). Today, I plotted the attached r_plotViolinOfAnnualE_new.eps > using R version 2.12.0 (2010-10-15). Both figures were produced via > the same script: > > ... > plot <- bwplot(year ~ Eann, data=df, horizontal = T, > xlab = "E / mSv", > ylab = "year", > box.ratio = 1.5, > panel=function(...) { > panel.grid(h=0, v=-1) > panel.average(fun=max, type="p", pch=3, col="black", ...) > panel.violin(adjust=0.3, kernel="gaussian", ...) > panel.average(fun=min, type="p", pch=3, col="black", ...) > panel.average(fun=mean, type="p", pch=20, col="black", ...) > panel.average(fun=median, type="p", pch=0, col="black", ...) > } > ) > ... > > The old version of R plotted points as defined by type="p", the new > version plotted lines. I don't know whether it is a bug or a new > feature. Anyway, is there an easy way of getting the old result with > the new version of R?
The change happened in Dec 2009, probably to prevent unintended capturing of 'type' (panel.average is an alias for panel.linejoin, which indicates that the original intention was to draw lines). In hindsight, this was probably not the best choice. However, you can get the same effect fairly easily with mypanel.average <- function(x, y, FUN = mean, ...) { panel.points(aggregate(as.numeric(y) ~ x, data = environment(), FUN = FUN), ...) } -Deepayan ______________________________________________ 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.