[R] one problem about how to hold graphic with R
Gavin Simpson
gavin.simpson at ucl.ac.uk
Tue Oct 31 15:08:07 CET 2006
On Tue, 2006-10-31 at 21:36 +0800, yang baohua wrote:
> Sorry to disturb you, but can you help me to solve one little problem?
> I want to draw a graphic after another with R
> but I cannot find the first one after that.
> Do you know the command to hold the graphic with R?
> I remember with Matlab you may use "hold on".
> Thanks.
>
>
You don't say which OS. On MS Windows one can turn on a history of plots
to the graphics device and replay your plots - it is in the menu bar for
example.
In all OSes, you can start up a new device to take the plot - which is
what Matlab does IIRC, so you have two or more plot windows on screen at
any one time. This is done like this:
plot(1:10)
x11()
plot(1:20)
x11()
plot(rnorm(100))
see ?Devices
You can set a device to be active, i.e. switch around between plotting
windows using dev.set(), e.g.:
> dev.cur() # example from above leaves device 4 active
X11
4
> dev.set(3) # switch to device
> dev.cur() # check
X11
3
> plot(sort(rnorm(100))) # plot something new on this device
Is this what you were looking for?
HTH
G
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [t] +44 (0)20 7679 0522
ECRC & ENSIS, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list