inset | R Documentation |
Inset new plots in existing plot windows.
inset(x, y = NULL, pct = 0.25, ...)
x |
a keyword (see details) or a vector of length two giving the positions on the current plot at which to draw the inset plot along the x-axis |
y |
ignored if |
pct |
inset plot scaling (only used if |
... |
additional graphical parameters passed to |
x
should be of the form x0, x1
and similar for y
giving the starting and ending coordinates to draw the inset plot and must
be in the range defined in the current plotting area.
Alternatively, x
can be a keyword ("bottomright", "bottom",
"bottomleft", "left", "topleft", "top", "topright" "right", or "center")
giving the approximate location of the inset plot. pct
is used to
adjust the size.
op <- par(no.readonly = TRUE)
plot(mpg ~ wt, data = mtcars, col = 'blue')
abline(lm(mpg ~ wt, data = mtcars), col = 'red')
inset('topright', pct = .4)
hist(mtcars$mpg, ann = FALSE, panel.last = box(),
col = 'dodgerblue2', las = 1)
par(op)
plot(1:10, type = 'n')
op <- par(no.readonly = TRUE)
Map(function(x) {
inset(x, las = 1, col = 'red', pct = 1/3)
plot(rnorm(10), ann = FALSE, axes = FALSE, panel.last = box())
par(op)
Sys.sleep(0.5)
}, c('bottomright', 'bottom', 'bottomleft', 'left',
'topleft', 'top', 'topright', 'right', 'center')
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.