inset {ggalign} | R Documentation |
Create a ggplot inset
Description
Create a ggplot inset
Usage
inset(plot, ..., align = "panel", on_top = TRUE, clip = TRUE, vp = NULL)
Arguments
plot |
Any graphic that can be converted into a |
... |
Additional arguments passed to the |
align |
A string specifying the area to place the plot: |
on_top |
A single boolean value indicates whether the graphic plot should be put frontmost. Note: the graphic plot will always put above the background. |
clip |
A single boolean value indicating whether the grob should be clipped if they expand outside their designated area. |
vp |
A |
Value
A patch_inset
object, which can be added in ggplot.
Examples
library(grid)
p1 <- ggplot(mtcars) +
geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) +
geom_boxplot(aes(gear, disp, group = gear))
p1 + inset(p2, vp = viewport(0.6, 0.6,
just = c(0, 0), width = 0.4, height = 0.4
))
[Package ggalign version 1.0.2 Index]