color_cor: Background colored correlation plot of two columns of data

Description Usage Arguments Author(s) Examples

View source: R/color_cor.R

Description

Display the correlation of the given data and

Usage

1
2
3
color_cor(data, mapping, color = I("black"), size = 6, palette = "RdYlGn",
  breaks = c(-0.99, -0.8, -0.6, 0.6, 0.8, 0.99), ..., use = "everything",
  method = "pearson", reversePalette = FALSE)

Arguments

data

data set using

mapping

aesthetics being used. Must contain 'x' and 'y'. 'color' will be ignored

color

color of main text. Default = "black"

size

ggplot2 size of main text. Default = 6

palette

should be a character string that matches a RColorBrewer color palette

breaks

can be a vector of breaks points between -1 and 1. If a single numeric number, will set breaks with that many groups

...

other arguments being supplied to ggally_text

use

use supplied to cor function

method

method suppied to cor function

reversePalette

boolean to determine if the palette should be reversed

Author(s)

Barret Schloerke schloerke@gmail.com

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
25
26
27
28
29
30
31
32
33
34
color_cor(iris, ggplot2::aes(x = Sepal.Length, y = Petal.Width))
color_cor(
  iris,
  ggplot2::aes(x = Sepal.Length, y = -1 * Petal.Width),
  method = "spearman"
)

require(GGally)
ggpairs(iris, 1:4, upper = list(continuous = color_cor))
# use kendall correlation, only three color groups and reverse the palette
ggpairs(
  iris, 1:3,
  lower = "blank",
  upper = list(
    continuous = wrap(
      color_cor,
      method = "kendall",
      breaks = 3,
      reversePalette = TRUE
    )
  )
)
# use spearman correlation, only three color groups but breaking at abs(0.2)
ggpairs(
  iris, 1:3,
  lower = "blank",
  upper = list(
    continuous = wrap(
      color_cor,
      method = "spearman",
      breaks = c(-0.20, 0.20)
    )
  )
)

schloerke/gsoc-ggduo-test documentation built on May 29, 2019, 3:41 p.m.