Plot credible intervals as shaded boxplots using hdr.boxplot
This function is essentially hdr.boxplot but it more
easily works with matrices of data, where each column is a different variable
of interest. It has some limitations though....
siberDensityPlot( dat, probs = c(95, 75, 50), xlab = "Group", ylab = "Value", xticklabels = NULL, yticklabels = NULL, clr = matrix(rep(grDevices::gray((9:1)/10), ncol(dat)), nrow = 9, ncol = ncol(dat)), scl = 1, xspc = 0.5, prn = F, ct = "mode", ylims = NULL, lbound = -Inf, ubound = Inf, main = "", ylab.line = 2, ... )
dat |
a matrix of data for which density region boxplots will be constructed and plotted for each column. |
probs |
a vector of credible intervals to represent as box edges.
Defaults to |
xlab |
a string for the x-axis label. Defaults to |
ylab |
a string of the y-axis label. Defaults to |
xticklabels |
a vector of strings to override the x-axis tick labels. |
yticklabels |
a vector of strings to override the y-axis tick labels. |
clr |
a matrix of colours to use for shading each of the box regions.
Defaults to greyscale |
scl |
a scalar multiplier to scale the box widths. Defaults to 1. |
xspc |
a scalar determining the amount of spacing between each box. Defaults to 0.5. |
prn |
a logical value determining whether summary statistics of each
column should be printed to screen |
ct |
a string of either |
ylims |
a vector of length two, specifying the lower and upper limits for the y-axis. Defaults to NULL which inspects the data for appropriate limits. |
lbound |
a lower boundary to specify on the distribution to avoid the
density kernel estimating values beyond that which can be expected a
priori. Useful for example when plotting dietary proportions which must lie
in the interval |
ubound |
an upper boundary to specify on the distribution to avoid the
density kernel estimating values beyond that which can be expected a
priori. Useful for example when plotting dietary proportions which must lie
in the interval |
main |
a title for the figure. Defaults to blank. |
ylab.line |
a postive scalar indicating the line spacing for rendering
the y-axis label. This is included as using the permille symbol has a
tendency to push the axis label off the plotting window margins. See the
|
... |
further graphical parameters for passing to
|
A new figure window.
: This function will not currently recognise and plot
multimodal distributions, unlike hdr.boxplot. You
should take care, and plot basic histograms of each variable (column in the
object you are passing) to siardensityplot and check that they are
indeed unimodal as expected.
# A basic default greyscale density plot
Y <- matrix(stats::rnorm(1000), 250, 4)
siberDensityPlot(Y)
# A more colourful example
my_clrs <- matrix(c("lightblue", "blue", "darkblue",
"red1", "red3", "red4",
"yellow1", "yellow3", "yellow4",
"turquoise", "turquoise3", "turquoise4"), nrow = 3, ncol = 4)
siberDensityPlot(Y, clr = my_clrs)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.