plotgg_var: Plot single variable.

View source: R/plotgg_var.r

plotgg_varR Documentation

Plot single variable.

Description

Make a box and whiskers plot of a single variable, while grouping by a variable.

Usage

plotgg_var(...)

## Default S3 method:
plotgg_var(Map, var.name, x, col = NULL, theme = theme_blackbox())

## S3 method for class 'Dataset'
plotgg_var(Dat, var.name, x, col = NULL, theme = theme_blackbox())

Arguments

Map

A data.frame where each row must correspond to a sample, and the row names represent sample IDs.

var.name

String indicating which variable to plot. Should correspond to a header name in Map

x

String indicating which variable to use as the x-axis in the plot. Should correspond to a header name in Map

col

String indicating which variable to use to color the plot. Can be the same or different as x. It should correspond to a header name in Map.

theme

A ggplot2 theme to be used woth the plot.

Dat

A Dataset object

Value

A ggplot2 plot.

Author(s)

Sur Herrera Paredes

Examples

data(Rhizo)
data(Rhizo.map)
data(Rhizo.tax)
Dat <- create_dataset(Rhizo,Rhizo.map,Rhizo.tax)
Dat$Map$Richness <- colSums(Dat$Tab > 0)

# Passing directly a data_frame
plotgg_var(Dat$Map, var.name = "Richness",
           x = "fraction")
plotgg_var(Dat$Map, var.name = "Richness",
           x = "fraction",col = "accession")

# Passing directly a Dataset object
plotgg_var(Dat, var.name = "Richness",
           x = "fraction")
plotgg_var(Dat, var.name = "Richness",
           x = "fraction",
           col = "accession")

surh/AMOR documentation built on Feb. 21, 2023, 6:31 a.m.