[R] Beginner graphics device questions.

Marianne Promberger mpromber at psych.upenn.edu
Mon Sep 8 20:26:31 CEST 2008

> On Monday, 08 September 2008, 10:59 (UTC-0700),
> rkevinburton at charter.net wrote:

>  If I issue another 'plot' command will it also be redirected
>  to the 'png' device? 

As long as that png device is the currently active device, yes.

> Does dev.off essentially reset the graphics
>  device to the default? 

It turns off the currently active device, making the next one in the
list active. See what's open using dev.list(). You can also specificy
one of those by doing dev.off(2) etc. 

> Second there is a note that if the name of the
>  file does not contain %d then every plot will essentially overwrite
>  the previous plot. So I think I can see how to get 'plot1.bmp',
>  'plot2.bmp', etc. What if I want a finer control over the name of the
>  graphics file? 
> What if I want to specify a name? Something like
>  'plotA.bmp', 'plotB.bmp', etc. ? Would I essentially have to call
>  'png' (or 'bmp' etc.) with a file name and then call dev.off?

yes, for example bmp(filename="path/if/any/plotA.bmp"). dev.off()
saves that. 

But again, you could then open another plotting more plots with bmp()
or maybe x11() or whatnot and close them explicitly by giving hte
number from dev.list()

for full info 




Marianne Promberger
Graduate student in Psychology

More information about the R-help mailing list