matrix_plot {socialmixr} | R Documentation |
Draws an image plot of a contact matrix with a legend strip and the numeric values in the cells.
Description
This function combines the R image.plot function with numeric contact rates in the matrix cells.
Usage
matrix_plot(
mij,
min.legend = 0,
max.legend = NA,
num.digits = 2,
num.colors = 50,
main,
xlab,
ylab,
legend.width,
cex.lab,
cex.axis,
cex.text,
color.palette = heat.colors,
...
)
Arguments
mij |
a contact matrix containing contact rates between participants of age i (rows) with contacts of age j (columns). This is the default matrix format of |
min.legend |
the color scale minimum (default = 0). Set to NA to use the minimium value of |
max.legend |
the color scale maximum (default = NA). Set to NA to use the maximum value of |
num.digits |
the number of digits when rounding the contact rates (default = 2). Use NA to disable this. |
num.colors |
the number of color breaks (default = 50) |
main |
the figure title |
xlab |
a title for the x axis (default: "Age group (years)") |
ylab |
a title for the y axis (default: "Contact age group (years)") |
legend.width |
width of the legend strip in characters. Default is 1. |
cex.lab |
size of the x and y labels (default: 1.2) |
cex.axis |
size of the axis labels (default: 0.8) |
cex.text |
size of the numeric values in the matrix (default: 1) |
color.palette |
the color palette to use (default: |
... |
further arguments to pass to |
Details
This is a function using the basic R graphics to make it easier for users of socialmixr to visualise social contact matrices.
Author(s)
Lander Willem
Examples
## Not run:
data(polymod)
mij <- contact_matrix(polymod, countries = "United Kingdom", age.limits = c(0, 18, 65))$matrix
matrix_plot(mij)
## End(Not run)