Creates a lollipop chart: a point anchored by a stem to a reference
line. This is a syntax-sugar composite mark combining
geom_segment and geom_point.
Usage
mark_lollipop(
plot,
mapping = NULL,
data = NULL,
stem_color = ._MARK_STYLE$soft,
stem_width = ._MARK_STYLE$lw_thin,
point_size = ._MARK_STYLE$point_head,
ref = 0,
...
)Arguments
- plot
A plotit object
- mapping
Optional new aesthetics
- data
Optional data for this layer
- stem_color
Colour for the stem lines (default
._MARK_STYLE$soft="grey50").- stem_width
Line width for stems (default 0.5).
- point_size
Point size for the lollipop head (default 3).
- ref
Baseline value for the stems (default 0).
- ...
Other arguments passed to
mark_point()
Details
Equivalent expansion:
p |> mark_rule(x = x, xend = x, y = ref, yend = y) |>
mark_point(x = x, y = y)Examples
df <- data.frame(cat = LETTERS[1:5], val = c(3, 7, 2, 9, 5))
plotit(df, encode(x = cat, y = val)) |>
mark_lollipop(point_size = 4, stem_color = "grey70")