Adrian
Adrian

Reputation: 21

Help with x11 and dev.off

Why does this code throw warnings & how should I rewrite it?

x11(width = 8, height = 8)
plot(1:10)
points(1, 5, col='red')
dev.off()  # Throws "Warning message: In dev.off() : Display list redraw incomplete"

The error disappears if I remove the x11() line. Thank you in advance,

Adrian

Upvotes: 2

Views: 1970

Answers (1)

aL3xa
aL3xa

Reputation: 36080

I can reproduce this bug, but only if I'm trying to source the code. I get two empty plot windows. You may have noticed that at first there's 8x8 X11 window, but then it's closed, and you end up with two default-sized windows (7x7), with the one in the front marked as ACTIVE. However, if you omit width and height parameters, everything works OK. This looks like X11 issue to me, and, frankly, I have no bloody idea what causes it, but it definitely has something to do with device geometry. If I set X11.options(width = 8, height = 8) and source the script, I get the same bug again.

Long story short, I can replicate the bug, but I have no idea what's causing it. Anyway, this yields no errors:

x11()
plot(1:10)
points(1, 5, col='red')
dev.off()

EDIT

I'm using Arch Linux FWIW, here's my sessionInfo():

R version 2.12.2 (2011-02-25)
Platform: i686-pc-linux-gnu (32-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

Upvotes: 1

Related Questions