pyramid_chart.Rd
Pyramid Chart
pyramid_chart(
data,
xvar,
yvar,
levelvar,
groupvar,
xlab,
alpha_set,
chartcolors
)
dataframe
demography data
value
x-axis
value
y-axis
Factor
two factor levels, one for each pyramid
Factor
two factor levels, one for each side of a pyramid
text
for x-axis label
Value
specify transparency of symbols
vector
two colors, one for each side of a pyramid
ggplot object
demography |>
dplyr::mutate(
Type = as.factor(paste0("Type ", Type)),
figprev = ifelse(
Gender == "Females", -1 * Prevalence / 100000, Prevalence / 100000
),
Sex = Gender
) |>
pyramid_chart(
levelvar = "Type", xvar = "figprev", yvar = "Age",
groupvar = "Sex", alpha_set = 0.7, chartcolors = colfun()$fig2_colors,
xlab = "Prevalence (x 100 000)"
)