Paul Murrell posted some comments on [ 
https://github.com/deepayan/lattice/issues/8 | 
https://github.com/deepayan/lattice/issues/8 ]

----- Original Message -----
From: "Bert Gunter" <bgunter.4...@gmail.com>
To: "Sebastien Bihorel" <sebastien.biho...@cognigencorp.com>
Cc: "R-help" <r-help@r-project.org>
Sent: Monday, June 18, 2018 4:15:29 PM
Subject: Re: [R] Porbably bug in panel.abline

hmmm... 
Youre right: something subtle is occurring. 

Here is a simpler reproducible example that illustrates the issue: 

a <- 10 
y <- x <- c(0,a) 
for(k in c(-1,0,1)){ 
print(xyplot( 
y~x, 
type = 'l', col="blue", 
panel = function(x,y,...){ 
panel.xyplot(x,y,...) 
panel.abline(c(a+k,-1), col="red") 
} 
))} 

Somehow, the "drawable limits" seem to exclude the corners of the plotting 
rectangle. 

I would guess that this has something to do with how the plotting viewport is 
clipped, but that's just a guess. 

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 12:05 PM, Sebastien Bihorel < [ 
mailto:sebastien.biho...@cognigencorp.com | sebastien.biho...@cognigencorp.com 
] > wrote: 




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" < [ mailto:bgunter.4...@gmail.com | bgunter.4...@gmail.com 
] > 
To: "Sebastien Bihorel" < [ mailto:sebastien.biho...@cognigencorp.com | 
sebastien.biho...@cognigencorp.com ] > 
Cc: "R-help" < [ mailto:r-help@r-project.org | r-help@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.biho...@cognigencorp.com | sebastien.biho...@cognigencorp.com 
] > wrote: 

BQ_BEGIN
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 | 
https://github.com/deepayan/lattice/issues/8 ] 

______________________________________________ 
[ mailto:R-help@r-project.org | R-help@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 ] 
PLEASE do read the posting guide [ http://www.r-project.org/posting-guide.html 
| http://www.R-project.org/posting-guide.html ] 
and provide commented, minimal, self-contained, reproducible code. 





BQ_END

______________________________________________
R-help@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.

Reply via email to