Heatmap

To create a heatmap using this module a simple heatmap() function is used with appropriate parameters.

Syntax:

Heatmap(m, col = c(), cluster_columns = FALSE, cluster_rows = FALSE, rect_gp = gpar() … )

Parameters:

  • m :  matrix or vector
  • cluster_columns : specify clusters for columns
  • cluster_rows : specify clusters for rows
  • rect_gp : to add gap spaces to heatmap

Example: Simple Heatmap 

R




library(ComplexHeatmap)
  
# code to create a simple heatmap
set.seed(2020)
  
# generate random numbers
d1 <- runif(500, 0, 1)
m<-matrix(d1,nrow = 20,ncol=10)
  
# randomize the data points
m<-m[,sample(ncol(m))]
  
Heatmap(m)


Output:

How To Make Heatmaps in R with ComplexHeatmap?

Heatmap is a Visualization technique in the form of a matrix. It is mainly used for analyzing the numeric feature in a dataset and to visualize the trend over the data. This technique can highlight the range of values using color intensity i.e it indicates higher values with brighter colors and the color gradually fades out for smaller values.

In this article, we will see how to plot heatmaps using the Heatmap( ) function of ComplexHeatmap Package in R programming language.

Similar Reads

Installation

To create heatmaps using ComplexHeatmap it has to be first installed and loaded into the working space....

Heatmap

To create a heatmap using this module a simple heatmap() function is used with appropriate parameters....

Customizing colors of a Heatmap

...

Heatmap with Column Clusters

To change the color of the heatmap col parameter is used with the values to change the color with....

Heatmap with Row Clusters

...

Heatmap with no clusters

We assign cluster_rows as FALSE to remove row clusters....

Combine two Heatmap together

...