mrainbowplot | R Documentation |
Makes a scatterplot of bivariate data and colors the observations according to their depth value.
mrainbowplot(x, depths, col = NULL, plot.options = list())
x |
An |
depths |
A column vector of length |
col |
An |
plot.options |
A list of available options:
|
The plot is made using ggplot2. The plot itself is returned by the function and is fully customisable using standard ggplot2 commands. Similar plots for multivariate data with p > 2
can be made using the ggpairs function in the library GGally
.
P. Segaert
data(cardata90)
Result <- projdepth(x = cardata90)
plot.options <- list(legend.title = "PD")
plot <- mrainbowplot(cardata90,
depths = Result$depthZ,
plot.options = plot.options)
plot + ggtitle("Rainbowplot based on projection depth")
# The default color range may be adjusted using the col argument.
RGBmatrix <- c(1, 0, 0, #Red
1, 1, 1, #White
0, 1, 0) #Green
RGBmatrix <- matrix(RGBmatrix, ncol = 3, byrow = TRUE)
plot <- mrainbowplot(cardata90,
depths = Result$depthZ,
col = RGBmatrix,
plot.options = plot.options)
plot + ggtitle("Rainbowplot based on projection depth")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.