plotFit: Plot Titer Fit from GLM Model

View source: R/plotFit.R

plotFitR Documentation

Plot Titer Fit from GLM Model

Description

Prepare an informative plot of viral titer from the GLM fit.

Usage

plotFit(
  fm,
  main = NULL,
  pch = 1,
  col = 1,
  col.pch = col,
  lty.fit = 1,
  col.fit = col,
  lty.ref = 2,
  col.ref = "gray",
  xlim = NULL,
  ylim = NULL,
  ann = par("ann"),
  xlab = NULL,
  ylab = NULL,
  axes = TRUE,
  frame.plot = axes,
  digits = 3,
  ...
)

Arguments

fm

fitted model or list of fitted models from getFit.

main

plot title as a character, vector of characters or list of characters to be used as the plot title(s). Values will be replicated as necessary. If NULL, the plot date will be used.

pch, col, col.pch

plot character and color for data points. The default color for the points and the fitted line is col but these can be changed with the appropriate argument. col will also be used as the default color for other plot elements.

lty.fit, col.fit

line type and color for the GLM best-fit line. Set lty.fit to NA to exclude the best-fit line.

lty.ref, col.ref

line type and color for the value on the x-axis that intersect the 63 NA to exclude the reference line.

xlim, ylim

optional parameters to override the default parameters of the full range of x values for xlim and c(0, 1) for ylim.

ann

a logical value indicating whether the default annotation (title and x and y axis labels) should appear on the plot.

xlab

a label for the x axis. If the unit attribute associated with fm is a volume (ml, ul, nl, pl or fl), the default will be the titer as IU per ml. Otherwise, the default will be the x-value corresponding to an MOI of 1 (63% point).

ylab

a label for the y axis, defaults to "Infected fraction".

axes

a logical value indicating whether both axes should be drawn on the plot.

frame.plot

a logical value indicating whether a box should be drawn around the plot.

digits

integer indicating the number of significant decimal places to use for the calculated x-axis label

...

arguments to be passed to plot.default

Details

Base graphics are used to prepare a plot with log = "x" from a single fitted model or a list of fitted models generated by getFit. The function calls getEC63 to derive the titer and include this information on the plot by default. The graphic parameters can be used to change or exclude many elements of the plot. See the help information in plot.default for details.

If fm is a list of fitted models, each will be plotted. Use par(ask = TRUE) to see each in turn or use par(mfrow = c(nr, nc)) to place nr x nc plots on one device.

Additional curves can be added with the addOneFit as shown in the examples.

Value

No value is returned. This function is called for the side-effect of producing a plot (or plots).

Examples

# sample result from tally() with two sets of data
  plotFit_data <- read.csv(system.file("extdata", "plotFit_data.csv", 
    package = "virustiter"))
  fm <- getFit(plotFit_data, by = "row")

# Default format and example with minimal annotation
  plotFit(fm$A)
  plotFit(fm$A, ann = FALSE, axes = FALSE, lty.ref = NA)

# Example of two plots
  plotFit(fm$A, "Two fits", xlab = "Multiplicity (ml/cell)")
  addOneFit(fm$B)
  legend("topleft", legend = c("A", "B"), lty = 1, col = c(1, 2), bty = "n")

# With two panel figure 
  par(mfrow = c(2, 1))
  plotFit(fm, main = names(fm))


ornelles/virustiter documentation built on March 29, 2024, 8:30 p.m.