PlotMetric {QuICSeedR}R Documentation

Create a customizable ggplot for metrics

Description

This is wrapper function to generate a ggplot object with default options for boxplot and jittered points. Additional ggplot2 functions can be applied to the plot.

Usage

PlotMetric(
  calculation,
  x = "content",
  y = "RAF",
  fill_var = NULL,
  point = TRUE,
  box = TRUE,
  base_theme = theme_bw(),
  ...
)

Arguments

calculation

A data frame containing the data to be plotted. Output of GetCalculation

x

Character string specifying the column name for the x-axis. Default is "content".

y

Character string specifying the column name for the y-axis. Default is "RAF".

fill_var

The name of the column to be used for fill color, or a vector of colors. If NULL, no fill color is applied. Default is NULL.

point

Logical. If TRUE (default), adds jittered points to the plot.

box

Logical. If TRUE (default), adds a boxplot to the plot.

base_theme

A ggplot2 theme object. Default is theme_bw().

...

Additional ggplot2 functions to be applied to the plot.

Value

A ggplot object.

Examples

# Define the path to the plate data file
plate_path <- system.file("extdata/20240716_p3", 
                          file = '20240716_p3_plate.xlsx', 
                          package = "QuICSeedR")
  
# Read the plate data
plate <- readxl::read_xlsx(plate_path)

# Define the path to the raw data file
raw_path <- system.file("extdata/20240716_p3", 
                        file = '20240716_p3_raw.xlsx', 
                        package = "QuICSeedR")
# Read the raw data
raw <- readxl::read_xlsx(raw_path)

# Get replicate data
replicate <- GetReplicate(plate)

# Ensure time displayed as decimal hours
plate_time = ConvertTime(raw)

#Get metadata and display the few rows 
meta = CleanMeta(raw, plate, replicate)

#Clean data 
cleanraw <- CleanRaw(meta, raw, plate_time)

#Get calculations using positive controls to normalize values. 
calculation = GetCalculation(raw = cleanraw, meta, norm = TRUE, norm_ct = 'Pos')

#Default plot
PlotMetric(calculation)
           

[Package QuICSeedR version 0.1.2 Index]