plot.mortalityTable: Plot multiple mortality tables (life tables) in one plot

View source: R/plot.mortalityTable.R

plot.mortalityTableR Documentation

Plot multiple mortality tables (life tables) in one plot

Description

plot.mortalityTable displays multiple life tables (objects of child classes of mortalityTable) in one plot, with a legend showing the names of the tables. If the argument reference not given, all mortality rates are plotted on a log-linear scale for comparison. If the argument reference is given and is a valid life table, then all death probabilities are scaled by the given reference table and the y-axis shows the death rates as percentage of the reference table.

Usage

## S3 method for class 'mortalityTable'
plot(x, ..., reference = NULL, trend = FALSE)

Arguments

x

First life table to be plotted. Must be a mortalityTable object for the dispatcher to call this function

...

Additional life tables to be plotted (mortalityTable objects) as well as any of the following parameters (which are passed on to plotMortalityTables or plotMortalityTableComparisons):

xlim,ylim

Axes limitatation (as a two-element vectors)

xlab,ylab

Axes labels (default for x-axis: "Alter", default for y-axis: "Sterbewahrscheinlichkeit q_x")

title

The plot title

legend.position

The position of the legend (default is c(0.9,0.1))

legend.key.width

The keywith of the lines in the legend (default is unit(25,"mm"))

reference

The reference table that determines the 100% values. If not given, the absolute mortality values are compared and plotted on a log-linear scale.

trend

If set to TRUE, the function plotMortalityTrend is used to plot the trends of the given tables.

See Also

plotMortalityTables and plotMortalityTableComparisons

Examples

# Load the Austrian census data
mortalityTables.load("Austria_Census")

# Plot some select census tables in a log-linear plot
plot(mort.AT.census.1869.male, mort.AT.census.1869.female,
     mort.AT.census.1971.male, mort.AT.census.1971.female,
     mort.AT.census.2011.male, mort.AT.census.2011.female,
     title="Austrian census tables",
     ylab=expression(q[x]), xlab="Age",
     xlim=c(0,90),
     legend.position=c(0.95,0.05))

# Compare some census tables with the mortality of 2011 Austrian males
plot(mort.AT.census.1869.male, mort.AT.census.1869.female,
     mort.AT.census.1971.male, mort.AT.census.1971.female,
     mort.AT.census.2011.male, mort.AT.census.2011.female,
     title="Austrian Census tables, relative to 2011 males",
     reference=mort.AT.census.2011.male)


MortalityTables documentation built on Nov. 2, 2023, 5:52 p.m.