auto_ggenrich: Make enrichment factor plot.

Description Usage Arguments Examples

View source: R/auto_ggenrich.R

Description

Make enrichment factor plot. If you regulate more options, use ggenrich().

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
30
auto_ggenrich(
  .data,
  .data_ref,
  .mapping,
  .mapping_ref,
  .xlim,
  .ylim,
  .xlab = expression(paste(italic("ε"^{     13 }), "C", " (‰)")),
  .ylab = expression(paste(italic("ε"^{     15 }), "N", " (‰)")),
  .point_size = 3,
  .stroke = 0.82,
  .shape_val = c(16, 17, 24),
  .cross_tip = 0.15,
  .linesize = 0.55,
  .axis_size = 0.55,
  .linetype = "dashed",
  .hjust = 0,
  .vjust = 0,
  .x_breaks = scales::breaks_extended(6),
  .y_breaks = scales::breaks_extended(6),
  .family = "Arial",
  .label_size = 4,
  .lab_title_size = 15,
  .lab_text_size = 12,
  .ratio = 2/3,
  .multi = F,
  .scaling = F,
  .scale_var = NULL,
  ...
)

Arguments

.data

data.

.data_ref

data of reference autotrophic plants.

.mapping

mapping, wrapping by aes(), augments passing through geom_***.

.mapping_ref

mapping, reference data set.

.xlim

range of x axis.

.ylim

range of y axis.

.xlab

title of x axis.

.ylab

title of y axis.

.point_size

size of point.

.stroke

edge of point

.shape_val

shape of point, passing scale_shape_manual().

.cross_tip

width and height of errorbar.

.linesize

width of line in error bar.

.linetype

dashed or dotted and so on.

.hjust

place of label (horizontal).

.vjust

place of label (vertical).

.x_breaks

break of x.

.y_breaks

break of y.

.family

font family, default Arial.

.label_size

label size.

.lab_title_size

axis title.

.lab_text_size

axis text

.ratio

ratio of plot.

.multi

logical

.scaling

logical

.scale_var

numeric

...

passed through theme().

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
library(ggplot2)
library(dplyr)
library(stringr)

data("demo")

# summarise data.
by_place <- demo %>%
  group_by(place, label) %>%
  summarise(across(where(is.numeric),
                   list(mean = mean, sd = sd),
                   .names = "{.fn}_{.col}")) %>%
  filter(place == "A")

# select "place is A".
val <- by_place %>%
  filter(str_detect(label, "target"))

# reference data.
ref <- by_place %>%
 filter(str_detect(label, "ref"))

# make plot (default).
auto_ggenrich(.data = val,
              .data_ref = ref,
              .mapping = aes(x = mean_epsilon13C, y = mean_epsilon15N,
                             xmin = mean_epsilon13C - sd_epsilon13C,
                             xmax = mean_epsilon13C + sd_epsilon13C,
                             ymin = mean_epsilon15N - sd_epsilon15N,
                             ymax = mean_epsilon15N + sd_epsilon15N,
                             shape = label,
                             label = label),
              .mapping_ref = aes(xmin = mean_epsilon13C - sd_epsilon13C,
                                 xmax = mean_epsilon13C + sd_epsilon13C,
                                 ymin = mean_epsilon15N - sd_epsilon15N,
                                 ymax = mean_epsilon15N + sd_epsilon15N),
              .xlim = c(-5, 3),
              .ylim = c(-3, 5),
              .family = NULL,
              .x_breaks = seq(-5, 3, 1),
              .y_breaks = seq(-3, 5, 1))

# make plot (manual).
auto_ggenrich(.data = val,
              .data_ref = ref,
              .mapping = aes(x = mean_epsilon13C, y = mean_epsilon15N,
                             xmin = mean_epsilon13C - sd_epsilon13C,
                             xmax = mean_epsilon13C + sd_epsilon13C,
                             ymin = mean_epsilon15N - sd_epsilon15N,
                             ymax = mean_epsilon15N + sd_epsilon15N,
                             shape = label,
                             label = label),
              .mapping_ref = aes(xmin = mean_epsilon13C - sd_epsilon13C,
                                 xmax = mean_epsilon13C + sd_epsilon13C,
                                 ymin = mean_epsilon15N - sd_epsilon15N,
                                 ymax = mean_epsilon15N + sd_epsilon15N),
              .xlim = c(-5, 3),
              .ylim = c(-3, 5),
              .xlab = expression(paste(italic("δ"^{13}), "C", " (\u2030)")),
              .ylab = expression(paste(italic("δ"^{15}), "N", " (\u2030)")),
              .hjust = 0, .vjust = 0,
              .cross_tip = .3,
              .stroke = 1,
              .linesize = .8,
              .axis_size = .8,
              .shape_val = c(24, 21, 16, 23),
              .x_breaks = scales::breaks_extended(6),
              .y_breaks = scales::breaks_extended(6),
              .family = NULL,
              .lab_title_size = 15,
              .lab_text_size = 12,
              .label_size = 4,
              .point_size = 3,
              .ratio = 1/2,
              .multi = F)

Hide-Fun/gglab documentation built on Dec. 31, 2020, 1 p.m.