plot.osmose.config: Plot method for 'osmose.config' objects

View source: R/osmose.config-class.R

plot.osmose.configR Documentation

Plot method for osmose.config objects

Description

This method takes a osmose.config object and produce useful plots.

This function implements a plot method for different osmose classes.

Usage

## S3 method for class 'osmose.config'
plot(x, what = "predation", ...)

## S3 method for class 'osmose.config.reproduction'
plot(
  x,
  type = 1,
  species = 0,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  initialYear = NULL,
  freq = 12,
  xlim = NULL,
  ylim = NULL,
  col = "black",
  axes = TRUE,
  border = NA,
  legend = TRUE,
  ...
)

## S3 method for class 'osmose.config.species'
plot(
  x,
  n = 100,
  type = 1,
  species = 0,
  speciesNames = NULL,
  addElements = c("segments", "points", "polygon", "text"),
  axes = TRUE,
  border = NA,
  xlim = NULL,
  ylim = NULL,
  legend = TRUE,
  col = "black",
  ...
)

## S3 method for class 'osmose.config.predation'
plot(
  x,
  type = 1,
  species = 0,
  speciesNames = NULL,
  addElements = c("segments", "points", "text"),
  axes = TRUE,
  border = NA,
  xlim = NULL,
  ylim = NULL,
  col = "gray70",
  legend = TRUE,
  ...
)

Arguments

x

osmose like object.

what

Variable name to plot. By default is what = "predation". See Details.

...

Extra arguments of the function.

type

A numeric value, indicating the type of plot to be used (type = 1, by default). See Details.

species

A numeric vector specifying the species that will be showed. If NULL (default), all the available species time series will be plotted. See Details.

speciesNames

A vector with the names for each species. If NULL (default) the names of x will be used.

start

A numeric value indicating the first element of the time indexation of the object x is specified with this parameter. By default start = NULL and the time indexation start with the first element of x.

end

A numeric value. The last element of the time indexation of the object x is specified with this parameter. By default end = NULL and the time indexation finish with the last element of x.

initialYear

A numeric value. It specifies the first element that is going to be used on the x axis for the plots.

freq

A numeric value to indicate the steps by year used in the time series. Default values, see Details.

xlim, ylim

numeric vectors of length 2, giving the x and y coordinates ranges.

col

A vector with the color names for the plots. By default col = NULL and the colors will be chosen by the function.

axes

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

border

the color to draw the border of CI polygons, bar plots and box plots. By default, border = NA, which means that no border will be drawn.

legend

logical do you want to show a legend of species? (valid only for those plot types TS-2)

n

numeric value indicating the number of steps that are going to be used to plot the growth curve (n = 100 as default). The larger is n, the more resolution the curve will have.

addElements

A character vector indicating extra graphical elements that can be included.

Details

Plot types will depend on the class of x, which is defined by what. Thereby,

  • what = predation: Generates a plot of size range as shadows for a selected species .

  • what = reproduction: Generates a single plots of seasonality of reproduction whether as lines (type = 1) or bars (type = 2)

  • what = species: Generates a plot of growth curve following the VB parameters defined on configuration files (type = 1).

species argument follows the indexation way of java: starting in zero, as osmose-java returns species outputs.

Default value for freq will be calculated from x: freq = 1/x$model$start.

Extra arguments can be passed using ... and depending on the type, you can modify arguments like: cex, cex.axis, border (useful for polygon and barplots), etc.

Note

Ellipsis (...) must be used carefully, since it will pass the arguments to different generic plot functions. For instance, type = 2 of osmose.config.reproduction method will use ... to pass arguments to barplot, so some arguments like cex may match with many formal arguments (e.g. cex.axis and cex.names), so it may cause errors.

Author(s)

Criscely Lujan Paredes


osmose-model/osmose documentation built on Feb. 16, 2023, 5 a.m.