Marging points can supplement a 2d display with annotations. Marging points
can highligth individual cases or values along a margin. The geometries
geom_x_margin_grob()
and geom_y_margin_grob()
behave similarly
geom_vline()
and geom_hline()
and share their "double
personality" as both annotations and geometries.
geom_x_margin_grob(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
xintercept,
sides = "b",
grob.shift = 0,
na.rm = FALSE,
show.legend = FALSE,
inherit.aes = FALSE
)geom_y_margin_grob(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
yintercept,
sides = "l",
grob.shift = 0,
na.rm = FALSE,
show.legend = FALSE,
inherit.aes = FALSE
)
A layer specific dataset - only needed if you want to override the plot defaults.
The statistical transformation to use on the data for this layer, as a string.
Position adjustment, either as a string, or the result of a call to a position adjustment function.
numeric Parameters that control the position of the marginal points. If these are set, data, mapping and show.legend are overridden.
A character string of length one that controls on which side of
the plot the grob annotations appear on. It can be set to a string
containing one of "t"
, "r"
, "b"
or "l"
, for
top, right, bottom, and left.
numeric value expressed in npc units for the shift of the marginal grob inwards from the edge of the plotting area.
If FALSE
(the default), removes missing values with a
warning. If TRUE
silently removes missing values.
logical. Should this layer be included in the legends?
NA
, the default, includes if any aesthetics are mapped. FALSE
never includes, and TRUE
always includes.
If FALSE
, overrides the default aesthetics, rather
than combining with them. This is most useful for helper functions that
define both data and aesthetics and shouldn't inherit behaviour from the
default plot specification, e.g. borders
.
A plot layer instance.
Other Geometries for marginal annotations in ggplots:
geom_x_margin_arrow()
,
geom_x_margin_point()
# NOT RUN {
# We can add icons to the margin of a plot to signal events
# }
Run the code above in your browser using DataLab