Hi!

I recently posted a similar question (entitled "Adding mean line to a lattice density plot"). Have not got any usable solution forcing my to fall back to the use of the normal 'plot' function. The problem was the same as yours: using panel.abline simply did not work, the position of the mean line was incorrect. I have posted a workaround (based on plot), please see my earlier posting.

HTH,
Kimmo

07.06.2012 15:37, maxbre wrote:
...and what if I need to plot another vertical line for showing also the
means for each panel?
by simply adding another call to panel.abline () seems not producing a
correct result for each panel

# medians and means for each panel:
dotplot(variety ~ yield | site, data = barley,
        scales=list(x=list(log=TRUE)),
        layout = c(1,6),
        panel = function(x,y,...) {
        panel.dotplot(x,y,...)
        median.values<- median(x)
        panel.abline(v=median.values, col.line="red")
        mean.values<- mean(x)
        panel.abline(v=mean.values, col.line="red")
})

In the dataset I'm currently working on (which is not the above mentioned
example) I've got a wrong plottting of the means for each panel, what I'm
missing?

thanks

______________________________________________
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.

Reply via email to