Tal Galili
2010-Mar-03 07:56 UTC
[R] Change current plot window size. Or - saving/loading current device plotting history
Hello dear R-help members, Very soon I am to give a lecture on R. And in that lecture I intend to move between: par(mfrow = c(1,1)) to par(mfrow = c(1,2)) back and forth. I anticipate this will damage the image proportions and will force me to resize the window. So far I have found it is possible to close the window and then reopen it (bigger/smaller) by using: dev.off()dev.new(width=5, height=4)plot(1:20) The issue with this solution is that I loose all the history I had with these windows. Thus, my question is either of two: 1) Can I resize a plot window AFTER it was created ? 2) can you save and load a plot history, for between closing and opening a graphic device ? Thanks for any help, Tal ----------------Contact Details:------------------------------------------------------- Contact me: Tal.Galili@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- [[alternative HTML version deleted]]
Prof Brian Ripley
2010-Mar-03 09:48 UTC
[R] Change current plot window size. Or - saving/loading current device plotting history
You haven't mentioned an OS nor a graphics device, So I will guess Windows and windows(), since that is commonest device with a history. On Wed, 3 Mar 2010, Tal Galili wrote:> Hello dear R-help members, > > Very soon I am to give a lecture on R. And in that lecture I intend to move > between: par(mfrow = c(1,1)) to par(mfrow = c(1,2)) back and forth. > I anticipate this will damage the image proportions and will force me to > resize the window. > So far I have found it is possible to close the window and then reopen it > (bigger/smaller) by using: > > > dev.off()dev.new(width=5, height=4)plot(1:20) > > > The issue with this solution is that I loose all the history I had with > these windows. > > Thus, my question is either of two: > 1) Can I resize a plot window AFTER it was created ?Not programmatically. But you can have more than one device open and switch between them by dev.next/dev.set ....> 2) can you save and load a plot history, for between closing and opening a > graphic device ?Yes, from the menu. There is also the more general recordPlot/replayPlot mechanism. But note that the windows() plot history is shared between devices, so if you work with multiple windows their histories will be interleaved. It is a history _of the session_ and so you can page back into the history of previously opened devices. So I would do this by opening a device with record = TRUE, and when I needed a different aspect ratio, open one with record = FALSE and close it when I was done with it.> Thanks for any help, > Tal > > ----------------Contact > Details:------------------------------------------------------- > Contact me: Tal.Galili at gmail.com | 972-52-7275845 > Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | > www.r-statistics.com (English) > ------------------------------------------------------------------------------------------------ Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595