heatmap1: Plot correlation or matrix heatmap.

Description Usage Arguments Author(s) References Examples

Description

heatmap1 This function Function creates a correlation heatmap using ggplot2 given a data.frame or matrix.

Usage

1
2
3
heatmap1(df,type='matrix', df.label=NULL,gtitle=NULL,
                   Nbreaks=NULL,Sig= FALSE,order=FALSE,
                   theme.1=NULL,data.only = FALSE)

Arguments

df

A data.frame or matrix containing only numeric data.

type

Identify df to be 'matrix'(default) or 'data'.

df.label

A matrix for heatmap labels.

gtitle

legend title.

Nbreaks

A number controls legend breaks.

Sig

Logical, if TRUE put pvalue and sig level for heatmap labels.

order

Logical, if TRUE reorder correlation matrix.

theme.1

A theme setting for ggplot2.

data.only

Logical, if TRUE returns correlation and pvalue.

Author(s)

Yuanzhen Lin <yzhlinscau@163.com>

References

Yuanzhen Lin. R & ASReml-R Statistics. China Forestry Publishing House. 2016 AAFMM website:https://github.com/yzhlinscau/AAFMM

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(AAFMM)

mydata<-mtcars

## plot data.frame
heatmap1(mydata,type='data',Sig=FALSE,Nbreaks = 8)

heatmap1(mydata,type='data',Sig=TRUE,Nbreaks = 8)

## plot correlation matrix
mcor <- round(cor(mydata),2)
cormat <- melt(mcor)

heatmap1(cormat,Sig=FALSE,Nbreaks = 8)
heatmap1(cormat,Sig=TRUE,Nbreaks = 8)

## plot any squared matrix
set.seed(2018)
label<-matrix(runif(121),nrow=11)
label<-round(label,2)

heatmap1(label)

  

yzhlinscau/AAFMM documentation built on May 4, 2019, 4:17 a.m.