| ggheat2 | R Documentation | 
Function to plot a heat map using ggplot.
ggheat2(
  data,
  corr = cor(data, use = "pairwise.complete"),
  cluster = TRUE,
  nbreaks = NULL,
  palette = if (is.null(nbreaks)) c("blue", "white", "red") else 1,
  legend_name = expression(rho),
  pch,
  cex = c(2, 6),
  label = FALSE,
  label_alpha = FALSE,
  label_color = "black",
  label_digits = 2,
  midpoint = 0,
  clim = c(-1, 1),
  ...
)
data | 
 a data frame or matrix (observations x variables) of numeric values  | 
corr | 
 a correlation matrix  | 
cluster | 
 logical or function; if   | 
nbreaks | 
 number of breaks to categorize the correlations (default is
  | 
palette | 
 for a continuous scale, a vector of length three giving the
low, mid, and high colors of the gradient (default is
  | 
legend_name | 
 the legend name; see   | 
pch | 
 (optional) plotting character; if   | 
cex | 
 size of   | 
label | 
 logical; if   | 
label_alpha | 
 logical, if   | 
label_color | 
 color of correlations (default is   | 
label_digits | 
 number of digits in correlation labels  | 
midpoint | 
 the midpoint value for continuous scaling of correlations
(default is   | 
clim | 
 vector of length two giving the limits of correlation
coefficients (default is   | 
... | 
 additional arguments passed to   | 
Default cluster method is stats::hclust(dist(x), method = 'average')
which will return a list containing a named vector, "order", which is used
to reorder the variables.
In order to pass a custom clustering function to cluster, the
function must take a single input (a correlation matrix) and return either
a vector or a list with a named vector, "order".
cor, ggheat, icorr,
corrplot, https://github.com/briatte/ggcorr
library('ggplot2')
ggheat2(mtcars)
ggheat2(mtcars, label = TRUE, label_alpha = TRUE, cluster = FALSE,
        ## additional args passed to diagonal labels
        colour = 'red', angle = 45, size = 7)
ggheat2(mtcars, pch = 19, nbreaks = 6, cex = c(2,10),
        palette = 'PuOr',         ## colorblind palette
        size = 5, hjust = 0.75) + ## passed to diag text
    labs(title = 'Correlation Matrix')
## custom clustering function
ggheat2(data = NULL, corr = cor(mtcars, use = 'pairwise'),
        nbreaks = 5, palette = 'Blues',
        cluster = function(...) sample(ncol(mtcars)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.