corrmorant_scales: Color and fill scales for correlation plots

Description Usage Arguments Details See Also Examples

Description

Diverging color gradients for the illustration of correlation strength.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
scale_color_corr(
  ...,
  option = c("A", "B", "C", "D"),
  limits = c(-1, 1),
  na.value = "#55FF55",
  guide = guide_colorbar(title = "Correlation"),
  aesthetics = "colour",
  direction = 1
)

scale_colour_corr(
  ...,
  option = c("A", "B", "C", "D"),
  limits = c(-1, 1),
  na.value = "#55FF55",
  guide = guide_colorbar(title = "Correlation"),
  aesthetics = "colour",
  direction = 1
)

scale_fill_corr(
  ...,
  option = c("A", "B", "C", "D"),
  limits = c(-1, 1),
  na.value = "#55FF55",
  guide = guide_colorbar(title = "Correlation"),
  aesthetics = "fill",
  direction = 1
)

Arguments

...

arguments passed to continuous scale

option

character in c("A", "B", "C", "D") specifying the desired color scale. Defaults to "A".

limits

Limits of the color gradient By default, the limits are set to c(-1, 1), and it is likely not a wise idea to change it as it might over-emphasise weak correlations.

na.value

the color to use for missing values. Defaults to '#55FF55'.

guide

Type of legend ("colourbar" for continuous legend, "legend" for legend with discrete values, or a ggplot guide function). Defaults to guide_colorbar(title = "Correlation") to have a reasonable standard scale title.

aesthetics

Character string or vector of character strings with the aesthetics linked to the scale. Defaults to "color" for scale_color_corr() and "fill" for scale_fill_corr().

direction

Numeric indicating the order of the scale. Defaults to 1; negative values reverse the order of the scale.

Details

The color and fill scales specified via option are built upon ggplot2::scale_colour_gradient2() and [ggplot2::scale_fill_gradient2(), which can easily be used to set up additional scales if the available options are not sufficient.

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
if(interactive()){
# drosera data with conditional coloring by correlation strength
ggcorrm(drosera) +
  lotri(geom_point(aes(col = .corr), alpha = 0.6)) +
  lotri(geom_smooth(aes(fill = .corr, col = .corr),
                    method = "lm", size = 0.3, alpha = 0.6)) +
  utri_corrtext(aes(color = .corr)) +
  dia_density(fill = "grey80", lower = .4) +
  dia_names(y_pos = .1) +
  scale_color_corr(option = "A", aesthetics = c("fill", "color"))
  }

## End(Not run)

r-link/corrmorant documentation built on Jan. 10, 2021, 7:26 p.m.