[R] Porbably bug in panel.abline
Bert Gunter
bgunter@4567 @end|ng |rom gm@||@com
Mon Jun 18 20:28:21 CEST 2018
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 <
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)
>
>
> Thank you in advance for your feedback.
>
> Sebastien
>
> PS: the problem was also posted at https://github.com/deepayan/
> lattice/issues/8
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list