# [R] Porbably bug in panel.abline

Sebastien Bihorel @eb@@t|en@b|hore| @end|ng |rom cogn|gencorp@com
Mon Jun 18 21:05:30 CEST 2018

```No, the intercept a^2 f the abline is exactly the upper limit of the data, so it is in the range.

From: "Bert Gunter" <bgunter.4567 using gmail.com>
To: "Sebastien Bihorel" <sebastien.bihorel using cognigencorp.com>
Cc: "R-help" <r-help using r-project.org>
Sent: Monday, June 18, 2018 2:28:21 PM
Subject: Re: [R] Porbably bug in panel.abline

Note that:

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

works. The problem is a^2 is just above the "drawable" y axis limit (it is the intercept of the line at x=0 with slope -1, of course). This also explains all your other comments.

Cheers,
Bert

--

Bert Gunter

"The trouble with having an open mind is that people keep coming along and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Mon, Jun 18, 2018 at 11:01 AM, Sebastien Bihorel < [ mailto:sebastien.bihorel using cognigencorp.com | sebastien.bihorel using cognigencorp.com ] > wrote:

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)

Sebastien

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

______________________________________________
[ mailto:R-help using r-project.org | R-help using r-project.org ] mailing list -- To UNSUBSCRIBE and more, see
[ https://stat.ethz.ch/mailman/listinfo/r-help | https://stat.ethz.ch/mailman/listinfo/r-help ]