If plot.type="functions"
, then years are plotted using a rainbow palette so the
earliest years are red, followed by orange, yellow, green, blue
and indigo with the most recent years plotted in violet.
If plot.type="time"
, then each age is shown as a separate time series in a time plot.
# S3 method for demogdata
plot(
x,
series = ifelse(!is.null(x$rate), names(x$rate)[1], names(x$pop)[1]),
datatype = ifelse(!is.null(x$rate), "rate", "pop"),
years = x$year,
ages = x$age,
max.age = max(x$age),
transform = (x$type == "mortality"),
plot.type = c("functions", "time", "depth", "density"),
type = "l",
main = NULL,
xlab,
ylab,
...
)# S3 method for demogdata
lines(
x,
series = ifelse(!is.null(x$rate), names(x$rate)[1], names(x$pop)[1]),
datatype = ifelse(!is.null(x$rate), "rate", ""),
years = x$year,
ages = x$age,
max.age = max(x$age),
transform = (x$type == "mortality"),
plot.type = c("functions", "time", "depth", "density"),
...
)
# S3 method for demogdata
points(..., pch = 1)
None. Function produces a plot
Demogdata object such as created using read.demogdata
or smooth.demogdata
.
Name of series to plot. Default: the first matrix within datatype
.
Name of demogdata object which contains series. Default “rate”. Alternative: “pop”.
Vector indicating which years to plot. Default: all available years.
Vector indicating which ages to plot. Default: all available ages.
Maximum age to plot. Default: all available ages.
Should a transformation of the data be plotted? Default is TRUE if the object contains mortality data and datatype="rate", and FALSE otherwise.
Type of plot: either “functions” or “time”.
What type of plot should be drawn. See plot
for possible types.
Main title for the plot.
Label for x-axis.
Label for y-axis.
Other plotting parameters. In points.demogdata
, all arguments are passed to lines.demogdata
.
Plotting character.
Rob J Hyndman
plot(fr.mort)
par(mfrow=c(1,2))
plot(aus.fert,plot.type="time")
plot(aus.fert,plot.type="functions")
Run the code above in your browser using DataLab