[R] Graphics devices: windows() and x11() vs default

Wollkind, Steven Steven.Wollkind at GeodeCapital.com
Wed Nov 7 15:01:24 CET 2007


I'm noticing some differences between making an explicit call to
windows() to generate a graphics device and going with whatever R gives
you when you just start plotting, which raises the question of just what
the nature of the default device is.  I've had a hard time researching
this so far, so I'm asking the list.

Here are two code snippets:

###############################
## Snippet 1
###############################
windows()
layout(matrix(c(1,2,3,4,5,6,7,8,9),3,3,byrow=T))
plot(1:10)
plot(1:10)
plot(1:10)

plot(1:10)
plot(1:10)
plot(1:10)

plot(1:10)
plot(1:10)
plot(1:10)




###################################
## Snippet 2
###################################
layout(matrix(c(1,2,3,4,5,6,7,8,9),3,3,byrow=T))
plot(1:10)
plot(1:10)
plot(1:10)

plot(1:10)
plot(1:10)
plot(1:10)

plot(1:10)
plot(1:10)
plot(1:10)



Run snippet 1, then resize the device.  If your system is like mine the
redrawing after resizing will be quick and nice.  Then run snippet 2 and
try the same thing.  On my system I have to wait ~1 second per plot as
they each get redrawn.  My question boils down to "What is the nature of
the default device you get without an explicit device generating call
and why does it behave differently?"

Now, this is obviously not that important in most cases, but I've been
working with the cairoDevice package (and will be emailing its
maintainer soon) and the graphics devices that it produces behave like
snippet 2 and not snippet 1.  As a first step to trying to correct this
I'm simply trying to understand the differences between the devices you
get with both methods.

Thanks
Steve Wollkind

Steve Wollkind
Associate Analyst
Geode Capital Management, LLC
1 Post Office Square / 28th Floor / Boston, MA 02109
steven.wollkind at geodecapital.com
Tel:   (617) 392-8991
Fax:  (617) 476-6389

This e-mail, and any attachments hereto, are intended fo...{{dropped:11}}



More information about the R-help mailing list