| geom_lollipop {ggalt} | R Documentation |
Lollipop charts
Description
The lollipop geom is used to create lollipop charts.
Usage
geom_lollipop(mapping = NULL, data = NULL, ..., horizontal = FALSE,
point.colour = NULL, point.size = NULL, na.rm = FALSE,
show.legend = NA, inherit.aes = TRUE)
Arguments
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
... |
other arguments passed on to |
horizontal |
|
point.colour |
the colour of the point |
point.size |
the size of the point |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
Details
Lollipop charts are the creation of Andy Cotgreave going back to 2011. They are a combination of a thin segment, starting at with a dot at the top and are a suitable alternative to or replacement for bar charts.
Use the horizontal parameter to abate the need for coord_flip()
(see the Arguments section for details).
A sample of the output from geom_lollipop():
Aesthetics
geom_point understands the following aesthetics (required aesthetics are in bold):
-
x -
y -
alpha -
colour -
fill -
group -
shape -
size -
stroke
Examples
df <- data.frame(trt=LETTERS[1:10],
value=seq(100, 10, by=-10))
ggplot(df, aes(trt, value)) + geom_lollipop()
ggplot(df, aes(value, trt)) + geom_lollipop(horizontal=TRUE)