Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a null graphics device?

I'm reading the R help page for ?devAskNewPage (it was linked from ?par...ask). I can't understand what par(ask=F) / par(ask=T) does.

What do I need to read about to understand this:

 If the current device is the null device, this will open a
 graphics device.

 ...

 The precise circumstances when the user will be asked to confirm a
 new page depend on the graphics subsystem.  Obviously this needs
 to be an interactive session.  In addition ‘recording’ needs to be
 in operation, so only when the display list is enabled (see
 ‘dev.control’) which it usually is only on a screen device.

What are devices, what is the null device, and what is a graphics subsystem? What is 'recording'? Are we talking about the difference between writing to png file and writing to the screen?

This feels a bit like learning what standard output and standard input are. Everybody uses the words but it was hard to find the definition (it was also hard to understand it). I googled for "null graphics device" and the top results don't explain to me, as a novice, what I need to know, in order to know where to look.

Just some links to the proper introductory reading would suffice. Thank you.

like image 703
isomorphismes Avatar asked Nov 30 '11 05:11

isomorphismes


1 Answers

In R, a device is the mechanism to produce graphical plots. This can be to screen (e.g. windows ) or to a variety of file types (e.g. png, pdf, tiff, etc).

For an entry point to the help file on devices, see ?Devices. The default devices for the three main operating systems are:

  • MS Windows: windows
  • Unix: X11
  • OS X: quartz

The null device means that no device is active. Here is a short code sequence that I used to find out whether I had an open device (dev.cur) and close it (dev.off). When I closed it, the remaining device was the null device.

> dev.cur()
windows 
      2 

> dev.off(2)
null device 
          1 

> dev.cur()
null device 
          1 

The meaning of graphics sybsystem is a bit more unclear. This seems to be the only page in all of help that uses the term. Thus I am guessing that the following are graphics subsystems:

  • base graphics
  • grid graphics (and anything built on top, including lattice and ggplot2)
  • rgl in package rgl
like image 187
Andrie Avatar answered Sep 21 '22 10:09

Andrie