| plot_matrix | R Documentation | 
Creates a heatmap of a symmetric matrix (e.g., correlation or covariance matrix).
plot_matrix(mat, order = FALSE, group.df = NULL, labels = TRUE)
| mat | A symmetric matrix. | 
| order | When  | 
| group.df | An optional data frame with columns containing the variable names followed by the group numbers.
When supplied, the heatmap is split into groups and then ordered (when  | 
| labels | When  | 
A heatmap with x- and y-axes displaying the variable numbers, and colour gradient ranging from blue (low value) to red (high value).
# Display a random correlation matrix.
cor_mat <- rand_cor_mat(
  n = 10,
  min.cor = -1,
  max.cor = 1
)
# Define groups.
group_df <- data.frame(variable = 1:10, group = c(1, 1, 1, 1, 2, 2, 2, 3, 3, 4))
plot_matrix(
  mat = cor_mat,
  group.df = group_df,
  order = TRUE,
  labels = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.