#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to create heatmap plot in R?
Description

To create heatmap plot using R programming.

Process

   Mainly used for Cluster analysis.

   It substitutes numbers with coloured cells

   R Package :gplots

   R Function : heatmap(x, scale=, xlab= ,ylab= , main= ,col= )

x: Data set(mtcars)

Scale: character indicating if the valuesshould be centered and scaled ineither the row direction or the column direction, or none.

xlab: Label for x

ylab: Label for y

main: title of the graph

Sapmle Code

#Heat Map
#Input
attach(mtcars)
input<-as.matrix(mtcars)

#heatmap
heatmap(input)

#Adding Scale and Labels
heatmap(input,scale=”column”,xlab = “Variable”,ylab = “Car Model”,main=”Heatmap Plot”)

#Changing color
heatmap(input,scale=”column”,xlab = “Variable”,ylab = “Car Model”,main=”Heatmap Plot”,col=terrain.colors(256))

Screenshots