pyramid_plot: pyramid_plot

Description Usage Arguments Value Examples

View source: R/pyramid.R

Description

Create a population pyramid plot. Traditionally, x-axis is gender and y-axis is age, so even though in this plot they both can have other names and values, we use "age" and "gender" for column names.

Usage

1
2
3
pyramid_plot(dat, yticks = NULL, xtitle = "", ytitle = "",
  yname = NULL, palette = c("tomato", "steelblue"),
  plot_bgcolor = "#ECF0F5", paper_bgcolor = "#FCFCFC")

Arguments

dat

tibble with columns "age" and "gender". "gender" should be a factor with two levels (e.g. "Female" and "Male"). If not a factor, will be converted into a factor. Age can be numeric or character.

yticks

values to show on the yaxis

xtitle

x-axis title

ytitle

y-axis title

yname

name for the variable on y-axis, to show in the hoverplate.

palette

vector of two colors, for Female and Male (in that order).

plot_bgcolor

plot background color

paper_bgcolor

plot paper color

Value

plotly object

Examples

1
#

rushkin/bitsandends documentation built on Oct. 21, 2020, 11:43 a.m.