plot.MicrobialGrowth: MicrobialGrowth plot function

View source: R/base.R

plot.MicrobialGrowthR Documentation

MicrobialGrowth plot function

Description

Plot function of MicrobialGrowth-objects.

Usage

## S3 method for class 'MicrobialGrowth'
plot(
  x,
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  n = 101,
  base = exp(1),
  display.coefficients = TRUE,
  display.model = TRUE,
  display.confint = FALSE,
  reg.args = list(col = "red"),
  title.args = list(line = 2),
  model.args = list(side = 4, line = 0),
  coefficients.args = list(cex = 0.9, line = 0.2, side = 3),
  confint.args = list(),
  ...
)

Arguments

x

MicrobialGrowth-object.

main

main title for the plot.

xlab

title for the x axis.

ylab

title for the y axis.

n

the number of x values at which to evaluate. See details section.

base

the logarithm base used for plot y-scaling. By default, the natural logarithm is used. Set NULL to not scale.

display.coefficients

boolean indicating the display or not of the values of coefficients (under the main title).

display.model

boolean indicating the model used for regression (on right side).

display.confint

boolean indicating the display or not of confidence intervals (in the form of curves and area).

reg.args

customization parameters of the curve obtained by regression (see curve for possible parameters).

title.args

title customization parameters main, xlab and ylab (see title for possible parameters).

model.args

model display customization parameters (see mtext for possible parameters).

coefficients.args

coefficient display customization parameters (see mtext for possible parameters).

confint.args

parameters for customizing the plotting of curves and area, corresponding to the confidence interval (see details section).

...

other graphical parameters (see plot).

Details

Similar to the curve function, the n argument corresponds to the number of points evaluated to draw the curves of regression, confidence bounds and the associated area. Increase its value for a more accurate representation.

When base is not NULL, the plot produced is log_n(N/N0), where n is the value specified in the base argument.

Value

No return value, called to plot a MicrobialGrowth-object.

Examples

# Example plot of a MicrobialGrowth-object obtained by regression
g <- MicrobialGrowth(example_data$time, example_data$y1, model="gompertz")
plot(g)

# Example plot of a user-created MicrobialGrowth-object (via MicrobialGrowth.create)
g <- MicrobialGrowth.create(N0 = 0.14, Nmax = 1.43, mu = 0.07, lambda = 45,
                                  xlim = c(0, 100), model="gompertz")
plot(g)

# Example plot with usual graphical parameters
plot(g, pch = 4, cex = 2, col = "blue", xlab = "Time (hours)", main = "Gompertz regression")

# Example of plot hiding the coefficients and customizing the curve obtained by regression
plot(g, display.coefficients = FALSE, reg.args = list(col = "green", lty = 2, lwd = 5))

# Example of a plot displaying the curves and area of the confidence interval
g <- MicrobialGrowth(example_data$time, example_data$y1, model="gompertz")
plot(g, display.confint = TRUE)

# Example of a plot customizing the confidence interval
plot(g, xlim = c(80, 100), ylim = c(1.8, 2.4), # Zoom in to see the example better
display.confint = TRUE,
confint.args = list(
  lines = list(col = "purple", lty = 2, lwd = 2),
  area = list(col = "green", opacity = 0.1)
))

# Example of a plot customizing the display of coefficients and titles
plot(g, main = "Gompertz",
coefficients.args = list(cex = 1.5, side = 4, line = 1),
title.args = list(col.main = "blue", col.lab = "red"))

MicrobialGrowth documentation built on April 12, 2025, 1:34 a.m.