plot_ci {metan}R Documentation

Plot the confidence interval for correlation

Description

[Stable]

This function plots the 95% confidence interval for Pearson's correlation coefficient generated by the function corr_ci.

Usage

plot_ci(
  object,
  fill = NULL,
  position.fill = 0.3,
  x.lab = NULL,
  y.lab = NULL,
  y.lim = NULL,
  y.breaks = waiver(),
  shape = 21,
  col.shape = "black",
  fill.shape = "orange",
  size.shape = 2.5,
  width.errbar = 0.2,
  main = TRUE,
  invert.axis = TRUE,
  reorder = TRUE,
  legend.position = "bottom",
  plot_theme = theme_metan()
)

Arguments

object

An object generate by the function corr_ci()

fill

If corr_ci() is computed with the argument by use fill to fill the shape by each level of the grouping variable by.

position.fill

The position of shapes and errorbar when fill is used. Defaults to 0.3.

x.lab

The label of x-axis, set to 'Pairwise combinations'. New arguments can be inserted as x.lab = 'my label'.

y.lab

The label of y-axis, set to 'Pearson's correlation coefficient' New arguments can be inserted as y.lab = 'my label'.

y.lim

The range of x-axis. Default is NULL. The same arguments than x.lim can be used.

y.breaks

The breaks to be plotted in the x-axis. Default is ⁠authomatic breaks⁠. The same arguments than x.breaks can be used.

shape

The shape point to represent the correlation coefficient. Default is 21 (circle). Values must be between 21-25: 21 (circle), 22 (square), 23 (diamond), 24 (up triangle), and 25 (low triangle).

col.shape

The color for the shape edge. Set to black.

fill.shape

The color to fill the shape. Set to orange.

size.shape

The size for the shape point. Set to 2.5.

width.errbar

The width for the errorbar showing the CI.

main

The title of the plot. Set to main = FALSE to ommite the plot title.

invert.axis

Should the names of the pairwise correlation appear in the y-axis?

reorder

Logical argument. If TRUE (default) the pairwise combinations are reordered according to the correlation coefficient.

legend.position

The position of the legend when using fill argument. Defaults to "bottom".

plot_theme

The graphical theme of the plot. Default is plot_theme = theme_metan(). For more details, see ggplot2::theme().

Value

An object of class ⁠gg, ggplot⁠.

Examples


library(metan)
library(dplyr)
# Traits that contains "E"
data_ge2 %>%
  select(contains('E')) %>%
  corr_ci() %>%
  plot_ci()

# Group by environment
# Traits PH, EH, EP, EL, and ED
# Select only correlations with PH

data_ge2 %>%
 corr_ci(PH, EP, EL, ED, CW,
         sel.var = "PH",
         by = ENV) %>%
 plot_ci(fill = ENV)


[Package metan version 1.18.0 Index]