plot_ci {metan} | R Documentation |
Plot the confidence interval for correlation
Description
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 |
fill |
If |
position.fill |
The position of shapes and errorbar when |
x.lab |
The label of x-axis, set to 'Pairwise combinations'. New
arguments can be inserted as |
y.lab |
The label of y-axis, set to 'Pearson's correlation coefficient'
New arguments can be inserted as |
y.lim |
The range of x-axis. Default is |
y.breaks |
The breaks to be plotted in the x-axis. Default is
|
shape |
The shape point to represent the correlation coefficient.
Default is |
col.shape |
The color for the shape edge. Set to |
fill.shape |
The color to fill the shape. Set to |
size.shape |
The size for the shape point. Set to |
width.errbar |
The width for the errorbar showing the CI. |
main |
The title of the plot. Set to |
invert.axis |
Should the names of the pairwise correlation appear in the y-axis? |
reorder |
Logical argument. If |
legend.position |
The position of the legend when using |
plot_theme |
The graphical theme of the plot. Default is
|
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)