Description Usage Arguments Examples
View source: R/corrplot-rectangles.R
Add a rectangle to a correlation plot
1 2 3 4 5 6 7 8 9 10 |
rstart |
The name of the variable contained in the correlation plot that will serve as the vertical starting point of the rectangle. |
rend |
The name of the variable contained in the correlation plot that will serve as the vertical ending point of the rectangle. |
cstart |
(optional) The name of the variable contained in the correlation plot that will serve as the horizontal starting point of the rectangle. If no cstart or cend provided, creates an on-diagonal rectangle automatically. cstart and cend allows for off-diagonal rectangles. |
cend |
(optional) The name of the variable contained in the correlation plot that will serve as the horizontal ending point of the rectangle. If no cstart or cend provided, creates an on-diagonal rectangle automatically. cstart and cend allows for off-diagonal rectangles. |
correlation_matrix |
The correlation matrix the correlation plot is based on. |
mirror |
If TRUE, also adds the equivalent rectangle from the other side of the diagonal (i.e. the "mirror" of the original). The function ignores this entirely if the rectangle is on the diagonal, as there is no mirror. |
lwd |
Determines the width of the rectangle lines. |
... |
Arguments to modify graphical parameters, etc. |
1 2 3 4 5 6 7 8 9 10 | #Adding an on-diagonal rectangle to a correlation plot with mirroring, using
#the Bechtoldt sample correlation matrix provided by the psych package.
library(corrplot)
library(psych)
corrplot(Bechtoldt)
make_rect(rstart="First_Names", rend="Flags", correlation_matrix=Bechtoldt, mirror=TRUE)
#Adding an off-diagonal rectangle
make_rect(rstart="First_Names", rend="Flags", cstart="First_Names",
cend="Sentences", correlation_matrix=Bechtoldt)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.