pop.cohorts.plot | R Documentation |
Extracts and plots population counts or results of expressions by cohorts.
cohorts(pop.pred, country = NULL, expression = NULL, pi = c(80, 95))
pop.cohorts.plot(pop.pred, country = NULL, expression = NULL, cohorts = NULL,
cohort.data = NULL, pi = c(80, 95), dev.ncol = 5, show.legend = TRUE,
legend.pos = "bottomleft", ann = par("ann"), add = FALSE, xlab = "", ylab = "",
main = NULL, xlim = NULL, ylim = NULL, col = "red", ...)
pop.pred |
Object of class |
country |
Name or numerical code of a country. If it is not given, |
expression |
Expression defining the population measure to be plotted. For syntax see |
pi |
Probability interval. It can be a single number or an array. |
cohorts |
Years of the cohorts to be plotted. By default, 10 future cohorts (starting from the last observed one) are used. It can be a single number or an array. |
cohort.data |
List with the cohort data obtained via the |
dev.ncol |
Number of column for the graphics device. |
show.legend |
Logical controlling whether the legend should be drawn. |
legend.pos |
Position of the legend passed to the |
ann, xlab, ylab, main, xlim, ylim, col, ... |
Graphical parameters passed to the |
add |
Logical specifying if the plot should be added to an existing graphics. |
pop.cohorts.plot
plots all cohorts passed in the cohorts
argument on the same scale of the y
-axis.
Function cohorts
returns a list where each element corresponds to one cohort. Each cohort element is a matrix with columns corresponding to years and rows corresponding to the median (first row) and quantiles of the given probability intervals.
Hana Sevcikova
pop.trajectories.plot
, pop.byage.plot
, pop.expressions
sim.dir <- file.path(find.package("bayesPop"), "ex-data", "Pop")
pred <- get.pop.prediction(sim.dir)
# Population cohorts
pop.cohorts.plot(pred, "Netherlands")
# plot specific cohorts using expression (must contain {})
pop.cohorts.plot(pred, expression="P528{}", cohorts=c(1960, 1980, 2000, 2020))
# the same as
cohort.data <- cohorts(pred, expression="P528{}")
pop.cohorts.plot(pred, cohort.data=cohort.data, cohorts=c(1960, 1980, 2000, 2020))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.