| ggHeatmap | R Documentation | 
Display a correlation matrix (or heatmap) using ggplot2
ggHeatmap(
  data,
  name.x,
  name.y,
  name.fill,
  add.text,
  plot = TRUE,
  round = NULL,
  title = "",
  xlab = "",
  ylab = "",
  legend_title = "correlation",
  na.value = "grey50",
  col_low = "blue",
  col_midpoint = "white",
  col_high = "red",
  midpoint = 0,
  limits = NULL,
  text.size = 15,
  angle.x = 90
)
data | 
 the dataset containing the correlation values. Either a matrix where each element is a correlation value or a data.frame/data.table containing in columns the correlation coefficients.  | 
name.x | 
 name of the column containing the label of the first outcome involved in the correlation.  | 
name.y | 
 name of the column containing the label of the second outcome involved in the correlation.  | 
name.fill | 
 name of the column containing the value of the correlation.  | 
add.text | 
 additional information to be displayed above the squares representing the correlation. Must name a column in data.  | 
plot | 
 should the graph be displayed.  | 
round | 
 if not   | 
title | 
 the title of the plot.  | 
xlab | 
 the name of the x axis.  | 
ylab | 
 the name of the y axis.  | 
legend_title | 
 the name of the legend.  | 
na.value | 
 the color used to display missing values (NA).  | 
col_low | 
 the color used to diplay low correlation values,  | 
col_midpoint | 
 the color used to diplay intermediate correlation values.  | 
col_high | 
 the color used to diplay high correlation values.  | 
midpoint | 
 the value corresponding to intermediate correlation value.  | 
limits | 
 the minimum and maximum correlation values used to build the color panel.  | 
text.size | 
 the size of the text in the plot.  | 
angle.x | 
 the inclination of the x labels.  | 
data must be coercible to data.table. 
a list containing:
plot: a ggplot object.
data: a data.table object used to create the plot.
fill <- runif(16)
df <- cbind(expand.grid(x = 1:4, y = 1:4),fill = fill)
ggHeatmap(df, name.x = "x", name.y = "y", name.fill = "fill")
M <- matrix(fill,4,4)
M[upper.tri(M)] <- NA
ggHeatmap(M)
rownames(M) <- paste0("R",1:4)
ggHeatmap(M, limits = c(0,0.5), add.text = "fill", round = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.