Wollkind, Steven
2007-Nov-07 14:01 UTC
[R] Graphics devices: windows() and x11() vs default
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}}
Martin Maechler
2007-Nov-07 15:24 UTC
[R] Graphics devices: windows() and x11() vs default
>>>>> "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