[R] help: how to change the size of a window after it has been created

Marc Schwartz MSchwartz at mn.rr.com
Thu Jul 14 15:12:18 CEST 2005


On Thu, 2005-07-14 at 14:38 +0200, wu sz wrote:
> Hello,
> 
> I wish to plot some figures in a window in turn, but the size of these
> figures is different, so how can I change the size of the window by
> resetting the parameters before each plotting?
> 
> Thank you,
> Shengzhe

Other than dragging a plot window with a mouse, I do not think that
there is a way to change the size of an open display device via code
(though somebody will no doubt correct me if I am wrong).

See ?Devices

Depending upon your OS, there is likely a 'width' and 'height' argument
for the screen display device for newly opened devices.

For example, under systems using X, where X11() is the screen device:

X11(width = 11, height = 8)
plot(1:10)

X11(width = 5, height = 5)
barplot(1:5)

In the above example, two separate plot windows will be created.

If you want to only have one open at a time, you can close the device
first using dev.off() before the subsequent plots. However, you lose the
current plot as soon as you close it.

X11(width = 11, height = 8)
plot(1:10)
dev.off()

X11(width = 5, height = 5)
barplot(1:5)
dev.off()

HTH,

Marc Schwartz




More information about the R-help mailing list