[R] Porbably bug in panel.abline

Sebastien Bihorel @eb@@tien@bihorel @ending from cognigencorp@com
Mon Jun 18 20:01:11 CEST 2018


Hi, 

I recently encountered situations in which reference lines are not drawn with the lattice panel.abline function. Please, consider the following example code: 


require(lattice)

a <- runif(1,0,100)
data <- data.frame(x=c(0,a^2), y=c(0,a^2))

xyplot(
  y~x,
  data = data,
  type = 'l',
  panel = function(x,y,...){
    panel.xyplot(x,y,...)
    panel.abline(c(a^2,-1.0), col=2)
  }
) 

Adding noise (eg panel.abline(c(a^2+0.01,-1.0), col=2)) or adding some axis limits seems to bypass the problem. 

The problem also happens for different data source and abline coefficients: 
data <- data.frame(x=c(18,81), y=c(18,81)) 
... 
panel.abline(c(99,-1.0), col=2)


Thank you in advance for your feedback.

Sebastien

PS: the problem was also posted at https://github.com/deepayan/lattice/issues/8



More information about the R-help mailing list