plot.sars: Plot Model Fits for a 'sars' Object

View source: R/class_plot.R

plot.sarsR Documentation

Plot Model Fits for a 'sars' Object

Description

S3 method for class 'sars'. plot.sars creates plots for objects of class 'sars' (type = 'fit', "lin_pow' and 'fit_collection'), using the R base plotting framework. The exact plot(s) constructed depends on the 'Type' attribute of the 'sars' object. For example, for a 'sars' object of Type 'fit', the plot.sars function returns a plot of the model fit (line) and the observed richness values (points). For a 'sars' object of Type 'fit_collection' the plot.sars function returns either a grid with n individual plots (corresponding to the n model fits in the fit_collection), or a single plot with all n model fits included.

For plotting a 'sar_average' object, see plot.multi.

Usage

## S3 method for class 'sars'
plot(
  x,
  mfplot = FALSE,
  xlab = NULL,
  ylab = NULL,
  pch = 16,
  cex = 1.2,
  pcol = "dodgerblue2",
  ModTitle = NULL,
  TiAdj = 0,
  TiLine = 0.5,
  cex.main = 1.5,
  cex.lab = 1.3,
  cex.axis = 1,
  yRange = NULL,
  lwd = 2,
  lcol = "dodgerblue2",
  di = NULL,
  pLeg = FALSE,
  ...
)

Arguments

x

An object of class 'sars'.

mfplot

Logical argument specifying whether the model fits in a fit_collection should be plotted on one single plot (mfplot = TRUE) or separate plots (mfplot = FALSE; the default).

xlab

Title for the x-axis (default depends on the Type attribute).

ylab

Title for the y-axis (default depends on the Type attribute).

pch

Plotting character (for points).

cex

A numerical vector giving the amount by which plotting symbols (points) should be scaled relative to the default.

pcol

Colour of the points.

ModTitle

Plot title (default is ModTitle = NULL, which reverts to a default name depending on the type of plot). For no title, use ModTitle = "". For a sars object of type fit_collection, a vector of names can be provided (e.g. letters[1:3]).

TiAdj

Which way the plot title is justified.

TiLine

Places the plot title this many lines outwards from the plot edge.

cex.main

The amount by which the plot title should be scaled relative to the default.

cex.lab

The amount by which the axis titles should be scaled relative to the default.

cex.axis

The amount by which the axis labels should be scaled relative to the default.

yRange

The range of the y-axis.

lwd

Line width.

lcol

Line colour.

di

Dimensions to be passed to par(mfrow=()) to specify the size of the plotting window, when plotting multiple plots from a sars object of Type fit_collection. For example, di = c(1, 3) creates a plotting window with 1 row and 3 columns. The default (null) creates a square plotting window of the correct size.

pLeg

Logical argument specifying whether or not the legend should be plotted for fit_collection plots (when mfplot = TRUE) or. When a large number of model fits are plotted the legend takes up a lot of space, and thus the default is pLeg = FALSE.

...

Further graphical parameters (see par, plot.default,title, lines) may be supplied as arguments.

Examples

data(galap)
#fit and plot a sars object of Type fit.
fit <- sar_power(galap)
plot(fit, ModTitle = "A)", lcol = "blue")

#fit and plot a sars object of Type fit_collection.
fc <- sar_multi(data = galap, obj = c("power", "loga", "epm1"), 
grid_start = "none")
plot(fc, ModTitle = letters[1:3], xlab = "Size of island")

txm676/mmSAR2 documentation built on Nov. 16, 2023, 2:33 p.m.