title: How to add an inset (subplot) to "topright" of an R plot?
body: <p>I'd like to have an inset within a plot that makes up 25% of the width and height of the plotting area (area where the graphs are).</p>
  
  <p>I tried:</p>
  
  <pre><code># datasets
  d0 &lt;- data.frame(x = rnorm(150, sd=5), y = rnorm(150, sd=5))
  d0_inset &lt;- data.frame(x = rnorm(1500, sd=5), y = rnorm(1500, sd=5))
  
  # ranges
  xlim &lt;- range(d0$x)
  ylim &lt;- range(d0$y)
  
  # plot
  plot(d0)
  
  # add inset
  par(fig = c(.75, 1, .75, 1), mar=c(0,0,0,0), new=TRUE)
  plot(d0_inset, col=2) # inset bottomright
  </code></pre>
  
  <p>This puts the inset to absolute topright and also uses 25% of the device-width. How can I change it to the coordinates and width of the area where the graphs are?</p>