| plot_lollipop | R Documentation |
Lollipop chart (stick + circle + value label) per category.
plot_lollipop(
data,
label_x = "",
label_y = "",
colors = NULL,
color_text = "black",
size_text = 3,
size_ball = 8,
alpha_ball = 0.2,
min_value = 0,
max_value_gap = 1
)
data |
data.frame with category and numeric values |
label_x |
x‑axis label |
label_y |
y‑axis label |
colors |
stick/circle color |
color_text |
color of the text inside the circle |
size_text |
text size |
size_ball |
circle size |
alpha_ball |
circle transparency (0–1) |
min_value |
minimum baseline for the stick |
max_value_gap |
gap from value to stick end |
Expects a data.frame with category in the first column and numeric values in subsequent columns.
Circles are drawn at values, with vertical segments extending from min_value to value - max_value_gap.
returns a ggplot2::ggplot graphic
#summarizing iris dataset
data <- iris |> dplyr::group_by(Species) |>
dplyr::summarize(Sepal.Length=mean(Sepal.Length))
head(data)
#ploting data
grf <- plot_lollipop(data, colors="blue", max_value_gap=0.2)
plot(grf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.