BubbleChart: Bubble Chart

View source: R/BubbleChart.R

BubbleChartR Documentation

Bubble Chart

Description

BubbleChart visualizes baseline vs fold change in titers

Usage

BubbleChart(
  dat_list,
  subjectCol = "SubjectID",
  fit = NULL,
  yMinZero = FALSE,
  eqSize = 6/log2(length(dat_list) + 1),
  colorBy = NULL,
  xlimits = c(1.5, 10.5),
  xbreaks = 2:10,
  ylimits = c(-0.5, 10),
  ybreaks = seq(0, 10, 2),
  plot = TRUE,
  cols = 2,
  ...
)

Arguments

dat_list

a named list like the one returned by FormatTiters. Values are assumed to be log2-transformed.

subjectCol

the name of the column specifying a subject ID. Default is "SubjectID".

fit

what type of fit to add. Current options are "lm" for linear model, "exp" for exponential, or NULL for no smoothing.

yMinZero

a logical specifying whether fitted y values below 0 should be set to 0.

eqSize

Text size of the equation. Only relevant if fit is not NULL

colorBy

a character string specifying an endpoint to colorBy or NULL (default) for no coloring.

xlimits

the x-axis limits (passed to scale_x_continuous)

xbreaks

the x-axis breaks (passed to scale_x_continuous)

ylimits

the y-axis limits (passed to scale_y_continuous)

ybreaks

the y-axis breaks (passed to scale_y_continuous)

plot

logical indicating whether to plot or not. Default is TRUE

cols

numeric specifying how many columns to layout plot

...

other arguments besides method and subjectCol passed to Calculate_maxRBA.

Details

This plot was designed for HAI titer data with baseline columns and fold change columns for multiple strains.

Value

(invisibly) a list of ggplot2 objects.

Author(s)

Stefan Avey

See Also

FormatTiters

Examples

## Prepare the data
titer_list <- FormatTiters(Year2_Titers)

## Basic plot without any fitted model
BubbleChart(titer_list)

## Change layout to plot all in a single column
BubbleChart(titer_list, cols = 1)

## Add a linear fit
BubbleChart(titer_list, fit = "lm")

## Add an exponential fit
BubbleChart(titer_list, fit = "exp")

## Add coloring by age
BubbleChart(titer_list, fit = "exp", colorBy = "AgeGroup")

stefanavey/titer documentation built on Jan. 27, 2023, 3:41 a.m.