powered by
Produces multiple density plots on a single axis, to compare the columns of a matrix or the elements of a list.
CompareDensities(x, legend.text = NULL, legend.location = "topright", legend.title = NULL, xlim = NULL, ylim = NULL, xlab = "parameter", ylab = "density", main = "", lty = NULL, col = "black", axes = TRUE, na.rm = TRUE, ...)
Called for its side effect, which is to produce multiple density plots on the current graphics device.
matrix or list of numeric vectors. A density plot is produced for each column of the matrix or element of the list.
(optional) character vector giving names of each density plot.
Entry that can be passed to legend.
legend
The legend title.
(optional) horizonal range of the plotting region. If omitted the region will be sized to fit all the observations in x.
x
(optional) vertical range of the plotting region. If omitted the region will be sized to fit all empirical density plots.
label to be placed on the horizontal axis
label to be placed on the vertical axis
main title for the plot
The line types to use for the different densities. See par. If NULL then a different line type will be used for each density.
par
NULL
vector of colors for the densities to be plotted.
Logical. Should axes and a box be drawn around the figure?
Logical value indicating whether NA's should be removed.
NA
Other graphical parameters passed to plot.density, and lines.
plot.density
lines
Steven L. Scott
density
x <- t(matrix(rnorm(5000, 1:5, 1:5), nrow=5)) CompareDensities(x, legend.text=c("EJ", "TK", "JT", "OtherEJ", "TJ"), col=rainbow(5), lwd=2)
Run the code above in your browser using DataLab