Re: [R] What's box() (exactly) doing?

2016-06-27 Thread Marius Hofert
On Mon, Jun 27, 2016 at 5:42 PM, Greg Snow <538...@gmail.com> wrote: > You can use the grconvertX and grconvertY functions to find the > coordinates (in user coordinates to pass to rect) of the figure region > (or other regions). > > Probably something like: > grconvertX(c(0,1), from='nfc',

Re: [R] What's box() (exactly) doing?

2016-06-27 Thread Greg Snow
You can use the grconvertX and grconvertY functions to find the coordinates (in user coordinates to pass to rect) of the figure region (or other regions). Probably something like: grconvertX(c(0,1), from='nfc', to='user') grconvertY(c(0,1), from='nfc', to='user') On Fri, Jun 24, 2016 at 8:19

Re: [R] What's box() (exactly) doing?

2016-06-24 Thread William Dunlap via R-help
Try this one: myBox <- function (which = c("plot", "figure"), ...) { # draw filled rectangle where box() would draw open rectangle which <- match.arg(which) oldXpd <- par("xpd") on.exit(par(oldXpd)) if (which == "plot") { do.call("rect", c(as.list(par("usr")[c(1, 3, 2,

Re: [R] What's box() (exactly) doing?

2016-06-24 Thread Marius Hofert
Hi Jim, Here is a follow-up question: How would you replicate box("figure") (instead of box() = box("plot"))? I tried to fill the plotted box but there seems to be no argument to box("figure") that does that. If that's indeed the case, one could work again with rect() (thus replicating

Re: [R] What's box() (exactly) doing?

2016-06-24 Thread Marius Hofert
Hi Jim, Thanks a lot, exactly what I was looking for. Cheers, Marius On Thu, Jun 23, 2016 at 11:06 PM, Jim Lemon wrote: > Hi Marius, > There are a few things that are happening here. First, the plot area > is not going to be the same as your x and y limits unless you

Re: [R] What's box() (exactly) doing?

2016-06-23 Thread Jim Lemon
Hi Marius, There are a few things that are happening here. First, the plot area is not going to be the same as your x and y limits unless you say so: # run your first example par("usr") [1] -0.04 1.04 -0.04 1.04 # but plot(NA, type = "n", ann = FALSE, axes = FALSE, xlim = 0:1, ylim =

Re: [R] What's box() (exactly) doing?

2016-06-23 Thread David Winsemius
> On Jun 23, 2016, at 7:29 PM, Marius Hofert wrote: > > Hi, > > I would like to replicate the behavior of box() with rect() (don't ask why). > However, my rect()angles are always too small. I looked a bit into the > internal C_box but > couldn't figure out how to

[R] What's box() (exactly) doing?

2016-06-23 Thread Marius Hofert
Hi, I would like to replicate the behavior of box() with rect() (don't ask why). However, my rect()angles are always too small. I looked a bit into the internal C_box but couldn't figure out how to solve the problem. Below is a minimal working (and a slightly bigger) example. Cheers, Marius ##