Learn R Programming

MortalitySmooth (version 2.3.4)

plot.HMDdata: Plot age and year specific demographic data

Description

Plot one or two-dimensional mortality data from a HMDdata object created by selectHMDdata.

Usage

"plot"(x, ...)

Arguments

x
a HMDdata object.
...
other plotting parameters. Either passed to plot in a one-dimensional plot or passed to levelplot in a two-dimensional surface.

Value

None. Function produces a plot.

Details

The function needs HMDdata to be uploaded. A HMDdata object can be produced by selectHMDdata. The function recognizes the HMDdata object, its dimensions and its attributes (country, type of data and sex). Given the dimensions of the object the function plot either a simple unidimensional plot or a more complex shaded contour map over age and years. Note that rates are automatically plotted in log-scale.

See Also

HMDdata, selectHMDdata.

Examples

Run this code
## 1-D plot
popDENf <- selectHMDdata("Denmark", "Population",
                         "Females", 50:100, 2000) 
plot(popDENf, main="Danish female population, 2000",
     xlab="ages", pch=2, col=2)
ratDENf <- selectHMDdata("Denmark", "Rates",
                         "Females", 50:100, 2000)
plot(ratDENf, main="Danish female log death rates, 2000",
     xlab="ages")

## 2-D plot
years <- 1950:2000
ages <- 0:100
popJAPf <- selectHMDdata("Japan", "Population", "Females",
                         ages, years)
plot(popJAPf, main="Japanese female population")
ratSWEf <- selectHMDdata("Sweden", "Rates", "Females")
plot(ratSWEf, main="Swedish female log death rates")

Run the code above in your browser using DataLab