metan (version 1.2.1)

plot.corr_coef: Create a correlation heat map

Description

Create a correlation heat map for object of class corr_coef

Usage

# S3 method for corr_coef
plot(
  x,
  type = "lower",
  diag = FALSE,
  reorder = TRUE,
  digits = 2,
  col.low = "blue",
  col.mid = "white",
  col.high = "red",
  lab.x.position = NULL,
  lab.y.position = NULL,
  legend.position = NULL,
  legend.title = "Pearson's\nCorrelation",
  size.text.plot = 3,
  size.text.lab = 10,
  ...
)

Arguments

x

The data set.

type

The type of heat map to produce. Either lower (default) to produce a lower triangle heat map or upper to produce an upper triangular heat map.

diag

Plot diagonal elements? Defaults to FALSE.

reorder

Reorder the correlation matrix to identify the hidden pattern? Defaults to FALSE.

digits

The digits to show in the heat map.

col.low, col.mid, col.high

The color for the low (-1), mid(0) and high (1) points in the color key. Defaults to blue, white, and red, respectively.

lab.x.position, lab.y.position

The position of the x and y axis label. Defaults to "bottom" and "right" if type = "lower" or "top" and "left" if type = "upper".

legend.position

The legend position in the plot.

legend.title

The title of the color key. Defaults to "Pearson's Correlation".

size.text.plot, size.text.lab

The size of the text in plot area (Defaults to 3) and labels (Defaults to 10), respectively. triangle heatmap.

...

Not used currently.

Value

An object of class gg, ggplot

Examples

Run this code
# NOT RUN {
library(metan)
# All numeric variables
all <- corr_coef(data_ge2)
plot(all)
plot(all, reorder = FALSE)

# Select variables
sel <- corr_coef(data_ge2, EP, EL, CD, CL)
plot(sel,
     type = "upper",
     reorder = FALSE,
     size.text.lab = 14,
     size.text.plot = 5)
# }

Run the code above in your browser using DataCamp Workspace