Skip to contents

Draw population pyramids.

Usage

draw_pyramid(
  x,
  show_value = TRUE,
  show_prop = TRUE,
  left_axis = NULL,
  right_axis = NULL,
  axis_fm = "g",
  axis_bm = "",
  axis_bi = 3,
  cgap = 0.3,
  cstep = 1,
  csize = 1,
  labs = c("Males", "Ages", "Females"),
  gl = TRUE,
  cadj = 0,
  cols = c("#006400", "#b32134"),
  dens = c(-1, -1),
  main = "",
  grid = c(2, 3)
)

Arguments

x

Class of 'canreg' or 'fbswicd'.

show_value

Logical value to draw the population numbers. Default is TRUE.

show_prop

Logical value to draw the pyramid using proportion. Default is TRUE.

left_axis

A vector of axis for left pyramid. If missing, automatically given using pretty().

right_axis

A vector of axis for right pyramid. If missing, left_axis is used.

axis_fm

A format code of formatC for plotting axis. If missing, "g" is used.

axis_bm

A big.mark of formatC for plotting axis. If missing, none.

axis_bi

A big.interval number of formatC for plotting axis. Default is 3.

cgap

The width of center gap (as ratio to each panel) to draw age-class. Default is 0.3.

cstep

The interval to write the labels of age classes. Default is 1.

csize

The font size factor to write the labels of age classes. Default is 1.

labs

The label of the left, center, and right pyramid. Default is c("Males", "Ages", "Females").

gl

Logical value to draw the vertical dotted lines. Default is TRUE.

cadj

The vertical adjustment factor for the labels of age classes. Default is -0.03.

cols

The color of the left and right pyramid. Default is c("lightblue", "pink").

dens

The density of hatching lines (/inch) for left and right pyramid. Default is c(-1, -1), when the pyramid will be filled.

main

The main title of the pyramid.

grid

Grids.

Value

Pyramids plot.