[Rd] screen doesn't handle redrawing properly (PR#837)

tov@ece.cmu.edu tov@ece.cmu.edu
Thu, 1 Feb 2001 20:20:41 +0100 (MET)


Hi.  As far as I understand it, there is a list of graphic primitives
stored for a device.  So for example, when I iconify/deiconify an X11
window, the plot will be redrawn.  Now screen (split.screen and
friends) appear not to handle this list properly, the list is reset or
not reset at odd times.  The commands below will show clearly what I
mean.  There are two effects:

  - After splitting the device real estate into two screens, I can
    plot on these screens, alternating between them.  When I then
    touch the window to force a redraw, *all* the plots are redrawn,
    not just the last (and visible) ones.
    [This happens when the X server runs on AIX, R runs on AIX or Sun.]

  - Again, after splitting, plotting on one screen can affect the
    other screen.  I.e. plot(...); plot (...) on the left screen can
    erase the *right* screen.
    [This happens for all platforms I have access to, AIX, Linux, Sun.]

The first effect may be due to a bad interaction with the X server,
but the second effect is surely not desirable, is it?  Am I mis-using
'screen' here?

R> split.screen (c(1,2))
[1] 1 2
R> # Draw 10000 points to make the effect obvious
R> screen (1)
R> plot (1:10000, 1:10000, main="1")
R> screen (2)
R> plot (1:10000, 1:10000, main="2")
R> # Ok, go back to screen 1, draw plots 3 and 4
R> screen (1)
R> plot (1:10000, 10000:1, main="3")
R> screen (2)
R> plot (1:10000, 10000:1, main="4")
R> 
R> ########################################
R> # NOW lower/raise window, do something to force device to redraw itself.
R> # You'll see again plot 1 (!), 2 (!), 3, and 4.  Why 1 and 2?
R> ########################################
R> 
R> # Here's how to erase screen 2 from screen 1 (!)
R> screen (1)
R> plot (1:10, 1:10, main="3a")
R> ########################################
R> # The following plot will erase screen 2
R> ########################################
R> plot (1:10, 1:10, main="3b")
R> 
R> # The good news is that this resets the list of graphic ops:
R> screen (2)
R> plot (1:10, 1:10, main="4")
R> # Now if you touch the window, you'll see only plot 3b and 4.

Regards,
  -tom

R> R.version
         _                   
platform sparc-sun-solaris2.7
arch     sparc               
os       solaris2.7          
system   sparc, solaris2.7   
status   Patched             
major    1                   
minor    2.1                 
year     2001                
month    01                  
day      31                  
language R                   

-- 
mailto:tov@ece.cmu.edu (Tom Vogels)   Tel: (412) 268-6638   FAX: -3204


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._