Miscellaneous plotting functions for demogdata type mortality data. Versatile plotting tool with an optional legend.
Plot an object of class demogdata
plot_dd(dd.obj, year = dd.obj$year, col = rainbow(length(year), start = 0.1), lpos = "UL", lpar = list(), ppar = T, ...)
dd.obj |
a mortality type data object of class |
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 |
ppar |
logical, if FALSE, ignores in the legend the plotting arguments |
... |
additional plotting arguments that are passed on to both |
Plot of mortality rates or number of deaths.
Zoltan Butt, Steven Haberman and Han Lin Shang
# 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=''))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.