Description Usage Arguments Value Examples
This function creates an interactive visualization of a correlation matrix. It is based on the R implementation of plotly.js, an (MIT licensed) web-based interactive charting library. It provides a clean implementation for plotting correlation matrices, easy use of different color schemes (Base R colors, Hex colors, RColorBrewer palettes as well as support for viridisLite). It also provides coloring options for backgrounds, grids and fonts matching different shinythemes.
1 2 3 4 5 6 7 8 9 10 |
data |
A matrix or data frame containing a correlation matrix. Must be numeric and symmetric. |
mask |
A logical scalar. If TRUE, removes the everything above and including the diagonal. Defaults to FALSE. |
color |
Either a vector of Base R colors (e.g. "red", "blue"), a vector of colors in hexadecimal #RRGGBB# format, a colorbrewer2.org palette name (e.g. "YlOrRd", "BrBG") or a viridis palette name (e.g. "viridis", "magma", "inferno"). Defaults to "RdBu". |
theme |
A character string of length 1 defining the name of a shinythemes template. Formatting will be applied to the background, gridline color, colorbar framing and font color. Defaults to the "default" theme. |
width |
Width in pixels (optional, defaults to automatic sizing). |
height |
Height in pixels (optional, defaults to automatic sizing). |
keepRatio |
A logical scalar. If TRUE, keeps a 1:1 ratio between x and y axis size. Defaults to TRUE. |
showGrid |
A logical scalar. If TRUE, displays gridlines. Defaults to TRUE. |
Returns a plotly object.
1 2 3 4 5 6 7 8 | data = cor(mtcars[,c(1,3:7)])
correallyPlot(data)
correallyPlot(data, mask = TRUE)
correallyPlot(data, mask = TRUE, color = "viridis", theme = "slate")
correallyPlot(data, mask = TRUE, width = 700, height = 500, keepRatio = FALSE, showGrid = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.