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

Martin Maechler maechler at stat.math.ethz.ch
Wed Nov 7 16:24:14 CET 2007


>>>>> "WS" == Wollkind, Steven <Steven.Wollkind at geodecapital.com>
>>>>>     on Wed, 7 Nov 2007 09:01:24 -0500 writes:

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

getOption("device")

  {the one you set by  options(device = ...)

is your current default graphics device.
That is platform dependent, and from what you say below,
I assume you have to use MS Windows, where typically
this default device *is* equivalent to windows().

However, there are many ways to change this default,
by initialization code, or loading other packages which change
it or ...

Before you can get more help,
we need to see your

   getOption("device")
and probably also
   sessionInfo()

Martin Maechler, ETH Zurich



    WS> Here are two code snippets:

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

    WS> plot(1:10)
    WS> plot(1:10)
    WS> plot(1:10)

    WS> plot(1:10)
    WS> plot(1:10)
    WS> plot(1:10)




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

    WS> plot(1:10)
    WS> plot(1:10)
    WS> plot(1:10)

    WS> plot(1:10)
    WS> plot(1:10)
    WS> plot(1:10)



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

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

    WS> Thanks
    WS> Steve Wollkind

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



More information about the R-help mailing list