theme_pyramid() is ggplot2::theme_minimal() adjusted for pyramids. It
removes the grid lines that run along the bars, which the age axis already
marks, keeps the major grid lines across the value axis, and puts the legend
above the plot, where it reads as a heading for the two sides.
Arguments
- ...
Arguments passed on to
ggplot2::theme_minimal(), such asbase_sizeorbase_family.- flipped
If
FALSE(the default), the pyramid is horizontal, with age on the y axis. Set it toTRUEfor a vertical pyramid, with age on x.
Examples
library(ggplot2)
france <- subset(europe_pop, country == "France" & year == 2024)
ggplot(france, aes(x = population, y = age, fill = sex)) +
geom_pyramid() +
coord_pyramid() +
theme_pyramid()