Adds a text label layer. For automatic label placement with collision
avoidance, install the optional ggrepel package and set
repel = TRUE.
Usage
mark_text(
plot,
mapping = NULL,
data = NULL,
position = NULL,
...,
repel = FALSE,
rasterize = FALSE,
rasterize_dpi = 300,
rasterize_dev = "cairo"
)Arguments
- plot
A plotit object
- mapping
Optional new aesthetics (e.g.
encode(label = ...))- data
Optional data for this layer
- position
Position adjustment.
- ...
Other arguments passed to
geom_textorgeom_text_repel. Withrepel = TRUEthe frequently used ggrepel passthrough parameters are (defaults from the ggrepel docs):max.overlaps(plural! labels overlapping more than this many others are dropped; defaultgetOption("ggrepel.max.overlaps", 10);Infkeeps every label),min.segment.length = 0.5(leader-line threshold,0draws all),force = 1,force_pull = 1,direction = "both",seed = NA(set a number for reproducible placement),nudge_x = 0,nudge_y = 0,point.padding = 1e-6,box.padding = 0.25,max.time = 0.5,max.iter = 10000,xlim = c(NA, NA),ylim = c(NA, NA).- repel
If
TRUE, useggrepel::geom_text_repelinstead ofgeom_text. Requires the ggrepel package.- rasterize
If
TRUE, rasterize viaggrastr::rasterise().- rasterize_dpi
DPI for rasterization (default 300).
- rasterize_dev
Graphics device for rasterization (default
"cairo").
