mrainbowplot {mrfDepth} | R Documentation |
Rainbow plot for bivariate data
Description
Makes a scatterplot of bivariate data and colors the observations according to their depth value.
Usage
mrainbowplot(x, depths, col = NULL, plot.options = list())
Arguments
x |
An |
depths |
A column vector of length |
col |
An |
plot.options |
A list of available options:
|
Details
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 can be made using the ggpairs function in the library
GGally
.
Author(s)
P. Segaert
Examples
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")