ggcormat: Print graphical representation of a correlation matrix.

Description Usage Arguments Value Examples

View source: R/plots.R

Description

Print graphical representation of a correlation matrix.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
ggcormat(
  cor_mat,
  p_mat = NULL,
  method = "Correlation",
  title = "",
  maxpoint = 2.1,
  textsize = 5,
  axistextsize = 2,
  titlesize = 3,
  breaklabels = NULL,
  lower_only = TRUE,
  .low = "blue3",
  .high = "red2",
  .legendtitle = NULL
)

Arguments

cor_mat

correlation matrix as produced by cor.

p_mat

Optional matrix of p-values; if provided, this is used to define size of dots rather than absolute correlation.

method

text specifying type of correlation.

title

plot title.

maxpoint

maximum for scale_size_manual, may need adjustment depending on plotsize.

textsize

for theme text.

axistextsize

relative text size for axes.

titlesize

as you already guessed, relative text size for title.

breaklabels

currently not used, intended for str_wrap.

lower_only

should only lower triangle be plotted?

.low

Color for heatmap.

.high

Color for heatmap.

.legendtitle

Optional name for color legend.

Value

A ggplot object, allowing further styling.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
coeff_pvalues <- cortestR(mtcars[, c("wt", "mpg", "qsec", "hp")],
  split = TRUE, sign_symbol = FALSE
)
# focus on coefficients:
ggcormat(cor_mat = coeff_pvalues$corout, maxpoint = 5)
# size take from p-value:
ggcormat(
  cor_mat = coeff_pvalues$corout,
  p_mat = coeff_pvalues$pout, maxpoint = 5
)

wrappedtools documentation built on Sept. 6, 2021, 5:08 p.m.