[R] X 11

(Ted Harding) Ted.Harding at manchester.ac.uk
Wed Apr 16 12:49:18 CEST 2008

On 16-Apr-08 10:21:00, Tommi Viitanen wrote:
> Hi,
> I would like to have at least 2 x11 windows open and make
> many graphs into them. I wonder how to draw the graph in
> a certain device so that the new graph will be in the place
> of the old one.
> For example I have open x11 with device numbers 1 and 2.
> I want to make plot to the device 1 without doing anything
> to the 2 and not making a new x11. Something like ?:
> x11()device 2;
> plot()
> dev.off()
> t. Tommi

Device 1 is the "null device". Ignore this. The first X11
window opened (either automatically by, say, a plot() command)
is device 2.

Unless you explicitly open further X11 windows, all plots
will go to this one, over-writing what was there before.

If you close this X11 window (e.g. by using the "close"
button in its frame) then you are back to device 1, with
no X11 windows available.

To open an additional X11 window, use


(and see ?X11 for options to this command).

The new X11 window will have device number 1 greater than
the highest device number already in existence. You can
repeat this command to open several X11 windows at once.

Thus you will have X11 windows with device numbers 2, 3, ...

To select which X11 window is to receive the next plot,
use the command dev.set(). For example, with X11 windows
open on devices 2, 3, 4,


will select device number 3 (the 2nd X11 window). You should
see the word "ACTIVE" in the title bar of the selected window,
and the word "inactive" in the title bars of the others. All
graphics output goes to the selected device, until you change
the selection with dev.set().

See ?dev.set for more things you can do with devices.

NB (re "device 1") -- if you have say 2 X11s on devices 2, 3,
and you do "dev.set(1)", then you will in fact open a new
X11 on device 4, which will be the ACTIVE device!

Hoping this helps,

E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 16-Apr-08                                       Time: 11:49:16
------------------------------ XFMail ------------------------------

More information about the R-help mailing list