Hello everyone, In plotting several graphics, I'd like to be able to plot a blank plot as in: par(mfrow=c(2,1)) plot(BLANK) hist(rgamma(100000,6463.7,scale=0.015471),xlim=c(0,120),main="Emergence") I realize screen allows me to do this, but I figure the functionality must be there. Is there an equivalent to plot(BLANK)? thanks, adrian PS. please reply direct as I'm not subscribed to the list.
How to plot a blank plot
7 messages · Chuck Cleland, Adrian Custer, Don MacQueen +2 more
Adrian Custer wrote:
In plotting several graphics, I'd like to be able to plot a blank plot as in: par(mfrow=c(2,1)) plot(BLANK) hist(rgamma(100000,6463.7,scale=0.015471),xlim=c(0,120),main="Emergence") I realize screen allows me to do this, but I figure the functionality must be there. Is there an equivalent to plot(BLANK)?
par(mfrow=c(2,1)) frame() hist(rgamma(100000,6463.7,scale=0.015471),xlim=c(0,120),main="Emergence") see ?frame
Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894
On Fri, 2004-02-13 at 14:11, Adrian Custer wrote:
Hello everyone, In plotting several graphics, I'd like to be able to plot a blank plot as in: par(mfrow=c(2,1)) plot(BLANK) hist(rgamma(100000,6463.7,scale=0.015471),xlim=c(0,120),main="Emergence") I realize screen allows me to do this, but I figure the functionality must be there. Is there an equivalent to plot(BLANK)? thanks, adrian PS. please reply direct as I'm not subscribed to the list.
Try either: par(mfrow=c(2,1)) frame() hist(rgamma(100000,6463.7,scale=0.015471),xlim=c(0,120),main="Emergence") or par(mfrow=c(2,1)) plot.new() hist(rgamma(100000,6463.7,scale=0.015471),xlim=c(0,120),main="Emergence") See ?plot.new or ?frame, which will lead you to the same help page. HTH, Marc Schwartz
frame() it is! I suspected there would be something simple. :-) Thanks everyone. --adrian
On Fri, 2004-02-13 at 12:28, Chuck Cleland wrote:
Adrian Custer wrote:
In plotting several graphics, I'd like to be able to plot a blank plot as in: par(mfrow=c(2,1)) plot(BLANK) hist(rgamma(100000,6463.7,scale=0.015471),xlim=c(0,120),main="Emergence") I realize screen allows me to do this, but I figure the functionality must be there. Is there an equivalent to plot(BLANK)?
par(mfrow=c(2,1)) frame() hist(rgamma(100000,6463.7,scale=0.015471),xlim=c(0,120),main="Emergence") see ?frame
And although frame() is obviously the better way, if you really
wanted to know what to put inside plot(), this will do it:
plot(1, type='n', xaxt='n', yaxt='n', xlab='', ylab='', bty='n')
-Don
At 12:41 PM -0800 2/13/04, Adrian Custer wrote:
frame() it is! I suspected there would be something simple. :-) Thanks everyone. --adrian On Fri, 2004-02-13 at 12:28, Chuck Cleland wrote:
Adrian Custer wrote:
> In plotting several graphics, I'd like to be able to plot a blank plot > as in: > > par(mfrow=c(2,1)) > plot(BLANK) > hist(rgamma(100000,6463.7,scale=0.015471),xlim=c(0,120),main="Emergence") > > I realize screen allows me to do this, but I figure the functionality > must be there. Is there an equivalent to plot(BLANK)?
par(mfrow=c(2,1)) frame() hist(rgamma(100000,6463.7,scale=0.015471),xlim=c(0,120),main="Emergence") see ?frame
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
-------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA
On Fri, 2004-02-13 at 15:31, Don MacQueen wrote:
And although frame() is obviously the better way, if you really
wanted to know what to put inside plot(), this will do it:
plot(1, type='n', xaxt='n', yaxt='n', xlab='', ylab='', bty='n')
-Don
A slightly shorter version of the same thing is: plot(1, ann = FALSE, axes = FALSE, type = "n") This gives you a blank plot area with the following, perhaps most important, par value:
par("usr")
[1] 0.568 1.432 0.568 1.432 plot.new() and frame() give you the following:
par("usr")
[1] -0.04 1.04 -0.04 1.04
Recall that par("usr") is c(x1, x2, y1, y2).
In either case, the above values can be overridden by a subsequent call
to par("usr"), such as the following:
par(usr = c(0, 1, 0, 1))
Thus setting the x and y ranges to known values if one needs them a
particular way.
Another way of accomplishing the same thing with a single function call
is:
plot(1, ann = FALSE, axes = FALSE, xlim = c(0, 1), ylim = c(0, 1),
type = "n", xaxs = "i", yaxs = "i")
The use of 'xaxs' and 'yaxs' sets the ranges of the x and y axes to
exactly the limits specified, rather than extending both by 4%, which is
the default (with values of "r"). This yields:
par("usr")
[1] 0 1 0 1 instead of:
par("usr")
[1] -0.04 1.04 -0.04 1.04
as seen above from a default call to plot.new() or frame().
So, ultimately, if you are not going to actually draw anything in the
particular plot region as is Adrian's situation, such that you are not
concerned with the coordinates and other details, plot.new() and frame()
are the quickest as Don, I and others have pointed out.
Indeed, as ?frame points out:
"...('frame' is an alias for 'plot.new')..."
frame
function () .Internal(plot.new()) <environment: namespace:base> So which one you pick is really a personal preference choice. As is the case frequently with R, there is more than one way to get to the same end point, some more 'elegant' than others. HTH, Marc Schwartz
On Fri, 13 Feb 2004 12:11:26 -0800, you wrote:
Hello everyone, In plotting several graphics, I'd like to be able to plot a blank plot as in: par(mfrow=c(2,1)) plot(BLANK) hist(rgamma(100000,6463.7,scale=0.015471),xlim=c(0,120),main="Emergence") I realize screen allows me to do this, but I figure the functionality must be there. Is there an equivalent to plot(BLANK)?
"frame()" is probably what you want. You can also get a blank plot (but set up coordinates, etc.) with something like plot(1, type="n", axes=F, xlab="", ylab="") This would allow you to plot points and lines and text in the empty space; frame() would not. Duncan Murdoch