Displaying 2 results from an estimated 2 matches for "subplotadd".
2016 Mar 15
2
[FORGED] Different results based on the order of arguments to par
Paul,
I was trying to make a minimal self contained example, but I guess I
went too far on the minimizing. The original problem came from code
more like:
library(TeachingDemos)
hist(rexp(1000), main='')
abline( v=1, col='red')
sp.par <- subplot(hist(rnorm(100), main=''), x='topright')
op <- par(sp.par[c('usr', 'plt')])
abline(v=0,
2016 Mar 15
0
[FORGED] Different results based on the order of arguments to par
...about
this behaviour, but ideally users would not be encouraged to do this at all.
I would prefer to see something along the lines of ...
hist(rexp(1000), main='')
abline( v=1, col='red')
sp.par <- subplot(hist(rnorm(100), main=''), x='topright')
subplotadd <- function(fun, pars) {
par(new=TRUE)
par(pars['plt'])
plot.new()
par(pars['usr'])
fun
}
subplotadd(abline(v=0, col='red'), sp.par)
Paul
On 16/03/16 04:31, Greg Snow wrote:
> Paul,
>
> I was trying to make a minimal...