plot_dd: Miscellaneous plotting functions for 'demogdata' type...

Description Usage Arguments Value Author(s) See Also Examples

Description

Plot an object of class demogdata

Usage

1
2
plot_dd(dd.obj, year = dd.obj$year, col = rainbow(length(year), start = 0.1), 
		lpos = "UL", lpar = list(), ppar = T, ...)

Arguments

dd.obj

a mortality type data object of class demogdata (or number of deaths type data object returned by extract.deaths)

year

vector of years to be included in the plotting (all available years by default)

col

color palette to be used in the plot (by default, it uses a sequence of rainbow colors)

lpos

a text identifier (one of "UR", "LR", "UL", "LL", "UC", "LC", "CL", "CR"; whereas the abbreviation is made up by U/L/C=Upper/Lower/Center, L/R/C=Left/Right/Center) or a list containing the coordinates (e.g. x and y) of the upper left corner of the legend/object.

lpar

list of additional arguments to be passed on to legend (other than legend, title, col or text.col)

ppar

logical, if FALSE, ignores in the legend the plotting arguments lty, lwd and pch (i.e. in case they are given in ...) and hence it creates a legend containing only text

...

additional plotting arguments that are passed on to both plot and legend functions (see par)

Value

Plot of mortality rates or number of deaths.

Author(s)

Zoltan Butt, Steven Haberman and Han Lin Shang

See Also

extract.deaths, plot.demogdata, legend, par, rainbow

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# plot log mortality rates with repositioned legend 
plot_dd(dd.cmi.pens, xlim=c(40, 110), lpar=list(x.intersp=-0.2, y.intersp=0.9, cex=0.85))
# plot (untransformed) mortality rates with repositioned legend
plot_dd(dd.cmi.pens, age=60:95, lpar=list(x.intersp=-0.2, y.intersp=0.9, cex=0.85), transf=FALSE)
# plot a small subset of log mortality rates (calendar years: 1985 - 1995)
#      and add a line with the overall mean rates
plot_dd(dd.cmi.pens, lpos=list(x=0.85,y=0.55), year=1985:1995, 
		lpar=list(x.intersp=-0.1, y.intersp=0.95, cex=0.9))
lines(mean(dd.cmi.pens),lwd=2, lty=3, col='red')
# legend(coord('LC'), legend='mean rate', lwd=2, lty=3, col='red', text.col='red')
# plot number of (extracted) deaths:
tmp.d <- extract.deaths(dd.cmi.pens, ages=55:100, y=1995:2003)
plot_dd(tmp.d, transf=FALSE, lty=1:5, ylab='Number of Deaths', 
		main=paste(tmp.d$lab, ": male (1995-2003)", sep='')) 

Example output

Loading required package: demography
Loading required package: forecast
This is demography 1.20 

Loading required package: rainbow
Loading required package: MASS
Loading required package: pcaPP
Loading required package: date
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 

ilc documentation built on May 2, 2019, 5:07 a.m.