sp_corrplot: A visualization of a correlation matrix.

Description Usage Arguments Value Examples

View source: R/sp_corrplot.R

Description

A visualization of a correlation matrix.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
sp_corrplot(
  data,
  method = "circle",
  type = "full",
  bg = "white",
  title = NULL,
  is.corr = FALSE,
  diag = TRUE,
  addCoef.col = NULL,
  addCoefasPercent = FALSE,
  order = "original",
  hclust.method = NULL,
  tl.pos = "n",
  tl.cex = 1,
  tl.col = "red",
  tl.srt = 90,
  cl.pos = NULL,
  cl.lim = NULL,
  cl.align.text = "c",
  saveplot = NULL,
  mar = c(0, 0, 0, 0),
  ...
)

Arguments

data

Matrix or data file (with header line, the first column will be treated as row names, tab separated).

method

The visualization method of correlation matrix to be used. Currently, it supports seven methods, named "circle" (default), "square", "ellipse", "number", "pie", "shade" and "color".

type

Type, "full" (default), "upper" or "lower", display full matrix, lower triangular or upper triangular matrix.

bg

The background color.

title

Title of the graph.

is.corr

Logical, whether the input matrix is a correlation matrix or not. We can visualize the non-correlation matrix by setting is.corr = FALSE.

diag

Logical, whether display the correlation coefficients on the principal diagonal.

addCoef.col

Color of coefficients added on the graph. If NULL (default), add no coefficients.

addCoefasPercent

Logic, whether translate coefficients into percentage style for spacesaving.

order

The ordering method of the correlation matrix. "original" for original order (default). "AOE" for the angular order of the eigenvectors. "FPC" for the first principal component order. "hclust" for the hierarchical clustering order. "alphabet" for alphabetical order.

hclust.method

The agglomeration method to be used when order is hclust. This should be one of "ward", "ward.D", "ward.D2", "single", "complete", "average", "mcquitty", "median" or "centroid".

tl.cex

Numeric, for the size of text label (variable names).

tl.col

The color of text label.

tl.srt

Numeric, for text label string rotation in degrees.

cl.pos

Character or logical, position of color labels; If character, it must be one of "r" (default if type=="upper" or "full"), "b" (default if type=="lower") or "n", "n" means don't draw colorlabel.

cl.lim

The limits (x1, x2) in the colorlabel.

cl.align.text

"l", "c" (default) or "r", for number-label in colorlabel, "l" means left, "c" means center, and "r" means right.

saveplot

Save plot to given file "a.pdf", "b.png".

...

Value

a grid object

Examples

1
2
3
4
5
6
data<-matrix(rnorm(100),nrow=20)
rownames(data)<- paste0("corrtest", 1:20)
colnames(data)<- paste0("zhou", 1:5)
sp_corrplot(data, cl.align.text = "l")
sp_corrplot(data,method="pie",type="lower",title="corrplot", cl.align.text = "l", mar=c(0,0,1,0))
sp_corrplot(data,method="ellipse",type="upper", cl.align.text = "l", tl.pos="td")

Tong-Chen/YSX documentation built on Jan. 25, 2021, 2:49 a.m.