Hi Petr Yes thanks I did get your response and it was helpful. However, I have now resorted to using barplot() to draw a legend (as all I wanted was colored boxes and text) and it works very well for my needs.
Basically, with layout() I'm not getting what I would expect, which may be a problem with my expectation rather than anything else. Like I say, I have a function which draws a plot, using layout to divide the plotting region into top and bottom. Fine. If the user calls my function, and then another plotting function, I would expect the new plotting function to overwrite the whole of the old plot - but it doesn't, it draws the new plot in the top half of the old plot, and clears the bottom plot. So what I want is something which says, after calling layout(), "OK, I'm done plotting in two different regions, I want you to treat the current device as a single region again". In a previous package I wrote, when using split.screen() to divide up the plotting region, dev.off() could be used for this purpose. But dev.off() closes the window/plot that I created using layout(). Mick -----Original Message----- From: Petr Pikal [mailto:[EMAIL PROTECTED] Sent: 10 December 2004 12:12 To: michael watson (IAH-C) Cc: [EMAIL PROTECTED] Subject: Re: [R] Returning to normal after call to layout() On 10 Dec 2004 at 11:47, michael watson (IAH-C) wrote: > Hi > > I have a function which draws a plot, using the layout() function to > divide the screen into two parts. The function works fine, but then > my next call to plot() draws the plot in the first section of the plot > I've just drawn using layout() - whereas what I want it to do is > create a new plot. > > I tried using dev.off() but that just closes the layout plot window, > which is not what I want. So my question is - after using the > layout() function, "layout(matrix(c(1,2), 2, 1))", how do I tell R Hi what is wrong on this: layout(matrix(c(1,2), 2, 1)) plot(1,1) plot(1,2) windows() #opens the new graphic device see ?device, ?windows plot(1,3) BTW did you read my previous post to your question about legend on a new window? Cheers Petr > that the next call to a plotting function should use a new window, and > not the layout window? I've looked in ?layout but there doesn't seem > to be anything in there. > > Thanks > Mick > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html