plot.osmose: Plot method for osmose objects

Description Usage Arguments Details Value Author(s)

View source: R/osmose-class.R

Description

This method takes a osmose object and produce useful plots

This function implements a plot method for different osmose classes.

Usage

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
## S3 method for class 'osmose'
plot(x, what = "biomass", ...)

## S3 method for class 'osmose.biomass'
plot(
  x,
  ts = TRUE,
  type = 1,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  initialYear = NULL,
  replicates = TRUE,
  freq = 12,
  horizontal = FALSE,
  conf = 0.95,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  alpha = NULL,
  border = NULL,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  legend = TRUE,
  units = "tonnes",
  ...
)

## S3 method for class 'osmose.abundance'
plot(
  x,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  initialYear = NULL,
  ts = TRUE,
  type = 1,
  replicates = TRUE,
  freq = 12,
  horizontal = FALSE,
  conf = 0.95,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  alpha = NULL,
  border = NULL,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  legend = TRUE,
  units = "individuals",
  ...
)

## S3 method for class 'osmose.yield'
plot(
  x,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  initialYear = NULL,
  ts = TRUE,
  type = 1,
  replicates = TRUE,
  freq = 12,
  horizontal = FALSE,
  conf = 0.95,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  alpha = NULL,
  border = NULL,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  legend = TRUE,
  units = "tonnes",
  ...
)

## S3 method for class 'osmose.yieldN'
plot(
  x,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  initialYear = NULL,
  ts = TRUE,
  type = 1,
  replicates = TRUE,
  freq = 12,
  horizontal = FALSE,
  conf = 0.95,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  alpha = NULL,
  border = NULL,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  legend = TRUE,
  units = "individuals",
  ...
)

## S3 method for class 'osmose.biomassByTL'
plot(
  x,
  type = 1,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  freq = 12,
  horizontal = FALSE,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  border = NULL,
  legend = TRUE,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  units = list(x = "", y = "tonnes"),
  ...
)

## S3 method for class 'osmose.biomassBySize'
plot(
  x,
  type = 1,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  freq = 12,
  horizontal = FALSE,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  border = NULL,
  legend = TRUE,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  units = list(x = "cm", y = "tonnes"),
  ...
)

## S3 method for class 'osmose.biomassByAge'
plot(
  x,
  type = 1,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  freq = 12,
  horizontal = FALSE,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  border = NULL,
  legend = TRUE,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  units = list(x = "years", y = "tonnes"),
  ...
)

## S3 method for class 'osmose.abundanceByTL'
plot(
  x,
  type = 1,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  freq = 12,
  horizontal = FALSE,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  border = NULL,
  legend = TRUE,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  units = list(x = "", y = "individuals"),
  ...
)

## S3 method for class 'osmose.abundanceBySize'
plot(
  x,
  type = 1,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  freq = 12,
  horizontal = FALSE,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  border = NULL,
  legend = TRUE,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  units = list(x = "cm", y = "individuals"),
  ...
)

## S3 method for class 'osmose.abundanceByAge'
plot(
  x,
  type = 1,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  freq = 12,
  horizontal = FALSE,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  border = NULL,
  legend = TRUE,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  units = list(x = "years", y = "individuals"),
  ...
)

## S3 method for class 'osmose.yieldNBySize'
plot(
  x,
  type = 1,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  freq = 12,
  horizontal = FALSE,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  border = NULL,
  legend = TRUE,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  units = list(x = "cm", y = "individuals"),
  ...
)

## S3 method for class 'osmose.yieldNByAge'
plot(
  x,
  type = 1,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  freq = 12,
  horizontal = FALSE,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  border = NULL,
  legend = TRUE,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  units = list(x = "years", y = "individuals"),
  ...
)

## S3 method for class 'osmose.yieldBySize'
plot(
  x,
  type = 1,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  freq = 12,
  horizontal = FALSE,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  border = NULL,
  legend = TRUE,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  units = list(x = "cm", y = "tonnes"),
  ...
)

## S3 method for class 'osmose.yieldByAge'
plot(
  x,
  type = 1,
  species = NULL,
  speciesNames = NULL,
  start = NULL,
  end = NULL,
  freq = 12,
  horizontal = FALSE,
  factor = 0.001,
  xlim = NULL,
  ylim = NULL,
  col = NULL,
  border = NULL,
  legend = TRUE,
  lty = 1,
  lwd = 1,
  axes = TRUE,
  units = list(x = "years", y = "tonnes"),
  ...
)

Arguments

x

osmose object.

what

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

...

Extra arguments of the function. See Details.

ts

logical parameter. By default ts = TRUE and the plots are going to be time series where the x-axis is the time. For plots where the x-axis is not the time ts = FALSE.

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.

replicates

logical. It controls to show whether the values in each simulation (TRUE) or the median of the values along the time (FALSE).

freq

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

horizontal

a logical value. If FALSE, plot types that do not represent time series (boxplots and barplots) will be drawn horizontally.

conf

numeric single value indicating the confidence interval showed in the plot as shadow. By default conf = 0.95.

factor

A number to indicate the scale of the variable on the y-axis. By default factor = 1e-3.

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.

alpha

factor modifying the opacity alpha given to confidence interval (CI) polygons (check adjustcolor). By default (NULL), its value will depend on the plot type. See Details.

border

the color to draw the border of CI polygons, bar plots and box plots. The default value (NULL) will depend on the type, see Details.

lty

The line type (check par).

lwd

The line width (check par).

axes

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

legend

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

units

String with units of the variable that defines the label set on top of the plot. If NULL (default), the value will depend on the class, see Details.

Details

what argument can take next values:

User can select within different plot types depending on the osmose class. So, for classes biomass, abundance, yield and yieldN (Group 1) the user must use ts and type arguments to specify the type of plot to draw.

So, for the Group 1 and ts = TRUE, user will select within:

For the Group 1 and ts = FALSE, user will select within:

The Group 2 refers classes of Group 1 with By specification (e.g. yieldNBySize, abundanceByAge, biomassByTL). There are 2 available plot types:

Both alpha and border controls the opacity and the color of border, respectively, for polygons, bar plots and box plots. So depending on the ts-type, they will have different default values:

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.

units could be whether a single character vector (currently applied on classes without By, e.g. osmose.biomass, osmose.yieldN) or a list of length 2 specifying the units for x and y (currently used with classes with By, e.g. plot.osmose.biomassBySize, plot.osmose.yieldNByAge).

Extra arguments can be passed from plot.default using ...: cex, cex.axis, border (useful for polygon, boxplots and barplots), etc. It is important to notice that, depending on where the ellipsys is passed, it allows and refuse the use of certain arguments. For instance, if the selected plot is a bar plot, the ... will be passed to the internal barplot call, so if cex argument is used, it will create a conflict and an error (a typical error of using cex in barplot function).

Value

A graph of an osmose object.

Author(s)

Criscely Lujan Paredes


osmose documentation built on April 28, 2020, 5:06 p.m.