save_group_lineplots: Save line plots with errorbars by group

View source: R/effect_plots.R

save_group_lineplotsR Documentation

Save line plots with errorbars by group

Description

Plots the change in the feature abundances as a function of e.g. time. A line is drawn for each group and error bars are added. A separate plot is drawn for each feature.

Usage

save_group_lineplots(
  object,
  all_features = FALSE,
  save = TRUE,
  file_path = NULL,
  format = "emf",
  x = time_col(object),
  group = group_col(object),
  title = "Feature_ID",
  subtitle = NULL,
  fun.data = "mean_cl_boot",
  fun = NULL,
  fun.min = NULL,
  fun.max = NULL,
  position_dodge_amount = 0.2,
  color_scale = getOption("notame.color_scale_dis"),
  text_base_size = 14,
  line_width = 0.5,
  point_size = 4,
  title_line_length = 40,
  theme = theme_bw(base_size = text_base_size),
  ...
)

Arguments

object

a MetaboSet object

all_features

logical, should all features be used? If FALSE (the default), flagged features are removed before visualization.

file_path

character, a file path for PDF or prefix added to the file paths for other formats

format

character, format in which the plots should be saved

x

character, name of the column to be used as x-axis

group

character, name of the column containing group information, used for coloring

title, subtitle

column names from fData to use as plot title/filename and subtitle. Set to NULL for no title/subtitle, this creates running numbered filenames

fun.data

passed to ggplot2::stat_summary and used for errorbars, "A function that is given the complete data and should return a data frame with variables ymin, y, and ymax."

fun.min, fun, fun.max

Alternative to fun.data, passed to ggplot2::stat_summary, "supply three individual functions that are each passed a vector of x's and should return a single number"

position_dodge_amount

numeric: how much the group mean points should dodge away from each other

color_scale

the color scale as returned by a ggplot function

text_base_size

integer, base size for text in figures

line_width

numeric, width of the lines

point_size

numeric, size of the points

title_line_length

integer, maximum length of the title line in characters, passed to stringr::str_wrap

theme

a ggplot theme to be added to the plot

...

other arguments to graphic device functions, like width and height

See Also

save_plot, stat_summary

Examples

## Not run: 
save_group_lineplots(drop_qcs(merged_sample),
  file_path = "./group_line_plots.pdf",
  format = "pdf"
)
save_group_lineplots(drop_qcs(merged_sample)[1:10],
  file_path = "./group_line_plots/",
  format = "png"
)

## End(Not run)
# Plot one feature
save_group_lineplots(drop_qcs(merged_sample[5, ]), save = FALSE)

antonvsdata/notame documentation built on Sept. 14, 2024, 11:09 p.m.