[R] Hmisc: xYplot and panel.lines

David Reitter reitter at cmu.edu
Fri May 1 00:49:25 CEST 2009


Using the Hmisc package, I tried to create an xYplot (single panel  
only) and was confused to find that I could not add anything else to  
the plot (abline, lines, etc.).

Thankfully, [1] points out panel functions.

This works as expected for panel.abline, but as soon as I'm using  
panel.lines (or llines or lpoints) from the "lattice" package (version  
0.17-17 with R 2.8.1), it seems that it is not using the coordinate  
system that the original plot used, i.e. the graph does not work at all.

My code:


pfunc <- function(x,y,...) {
   panel.xYplot(x, y, ...)
   panel.abline(h=4.0, col = "grey") # works fine
   panel.lines(-d$chosenValveSetting, col="orange")  # in the wrong  
place
}

xYplot(I(AmountInTank) + I(-UserOutFlow+UserInFlow) + I(EnvirInFlow) ~  
Time.Step,  data=subset(h, Version=="Linear increase"), nx=F,  
method=smean.cl.boot, type='b',lty.bands=c(2,2), ylim=c(-20,20),  
panel=pfunc)


What am I doing wrong?
Hmisc 3.6.0, but older versions reacted similarly.


Thanks for your help!




[1] http://tolstoy.newcastle.edu.au/R/help/06/01/18860.html




More information about the R-help mailing list