You can modify the alignment of inset plots with the vjust
and hjust aesthetics. These can either be a number between 0
(right/bottom) and 1 (top/left) or a character ("left", "middle", "right",
"bottom", "center", "top").
You can modify the size of inset plots with the vp.width and
vp.height aesthetics. These can take a number between 0 (smallest
possible inset) and 1 (whole plotting area width or height). The default
value for for both of these aesthetics is 1/5. Thus, in contrast to
geom_text and geom_text_s the size of
the insets remains the same relative to the size of the plotting area
irrespective of how the plot is rendered. The aspect ratio of insets is
preserved and size is adjusted until the whole inset fits within the
viewport.
You can modify inset plot alignment with the `vjust` and `hjust`
aesthetics. These can either be a number between 0 (right/bottom) and 1
(top/left) or a character (`"left"`, `"middle"`, `"right"`, `"bottom"`,
`"center"`, `"top"`). There several two special alignments: `"inward"` and
`"outward"`. Inward always aligns text towards the center of the plotting
area, and outward aligns it away from the center of the plotting area. It
tagged with `_mean` or `_median` the mean or median of the data in the
panel along the corresponding axis is used as center.
By default this geom uses position_nudge_center which is
backwards compatible with position_nudge but
provides additional control on the direction of the nudging. In contrast to
position_nudge, position_nudge_center
and all other position functions defined in packages 'ggpp' and 'ggrepel'
keep the original coordinates thus allowing the plotting of connecting
segments and arrows.
This geom works only with tibbles as data, as its expects a list of
ggplot objects ("gg" class) to be mapped to the label aesthetic.
The x and y aesthetics determine the position of the whole
inset plot, similarly to that of a text label, justification is interpreted
as indicating the position of the plot with respect to its x and y
coordinates in the data, and angle is used to rotate the plot as a
whole.
In the case of geom_plot_npc(), npcx and npcy
aesthetics determine the position of the inset plot. As for text labels,
justification is interpreted as indicating the position of the inset plot
with respect to its npcx and npcy coordinates, and
angle is used to rotate the plot as a whole.
annotate cannot be used with geom = "plot".
Use annotate (automatic unless 'ggpp' is not attached) as
redefined in 'ggpp' when adding inset plots as annotations (automatic
unless 'ggpp' is not attached).
The "width" and "height" of an inset as for a text element are 0, so
stacking and dodging inset plots will not work by default, and axis limits
are not automatically expanded to include all inset plots. Obviously,
insets do have height and width, but they are physical units, not data
units. The amount of space they occupy on the main plot is not constant in
data units of the base plot: when you modify scale limits, inset plots stay
the same size relative to the physical size of the base plot.