plotSDA: Add SDA fit and SDA parameters to an existing plot of oxygen...

Description Usage Arguments Details Warning Author(s) References See Also Examples

View source: R/plotSDA.R

Description

Displays the SDA line fitted by calcSDA on top of a plot of MO2 vs time. Also displayed is coloured representation of the magnitude of SDA (the area between the fitted line and the horizontal line representing SMR) and the values of peak, time-to-peak, duration and magnitude.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
plotSDA(
  my.sda,
  show.par = T,
  show.var = T,
  show.smr.line = T,
  show.feeding = T,
  show.mag.arrow = T,
  peak.lab.pos = NULL,
  mag.lab.pos = NULL,
  smr.lab.pos = c("2L", "1L", "none"),
  lty.smr = 1,
  col.smr = "orange",
  lty.feeding = 1,
  col.feeding = "seagreen",
  Cex.par = 0.8,
  Cex.sda = 0.9,
  col.sda = rgb(1, 0, 0, 0.2),
  ...
)

Arguments

my.sda

Object created by calcSDA.

show.par

Boolean, if TRUE, displays in upper-left of plot the values of tau and lambda that were used to obtain the fitted line.

show.var

Boolean, if TRUE, displays the values of peak MO2 (net, i.e. after removal of SMR), time to peak, duration and magnitude of SDA.

show.smr.line

Boolean, TRUE displays a horizontal line at SMR.

show.feeding

Boolean, TRUE displays a vertical line at time zero to illustrate feeding time.

show.mag.arrow

Boolean, TRUE displays an arrow from the word "magnitude" to the shaded area representing the area under the curve.

peak.lab.pos

If NULL, the function tries to calculate a position for the label associated with the peak of SDA. A (x, y) pair can be provided if the calculated position is inadequate.

mag.lab.pos

If NULL, the function tries to calculate a position for the label associated with the magnitude of SDA. A (x, y) pair can be provided if the calculated position is inadequate.

smr.lab.pos

Although a horizontal line depicting SMR is shown, the value of SMR is only shown if requested, either in one string below SMR (1L) or in two parts, one above and one below SMR (2L).

lty.smr

Line type for SMR, same meaning as lty for any line in R.

col.smr

Colour of the horizontal line representing SMR.

lty.feeding

Line type for time of feeding, same meaning as lty for any line in R.

col.feeding

Colour of the vertical line representing feeding time.

Cex.par

Size of the text for tau and lambda. Same use as cex parameter in text.

Cex.sda

Size of the text for the SDA parameters. Same use as cex parameter in text

col.sda

Colour of the shading representing SDA magnitude.

...

Other graphics parameters may work.

Details

Add SDA details to an existing plot of MO2 x time.

Warning

The automatic positioning of SMR and of the SDA parameters works best when plots have a longer X axis than Y axis. On square plots you will probably have to position these labels yourself using the arguments peak.lab.pos and mag.lab.pos. On plots showing data before and after feeding, the space to draw an arrow associated with magnitude (show.mag.arrow) is restricted and the result is often unattractive, it may be necessary to set this argument to FALSE.

Author(s)

Denis Chabot, Institut Maurice-Lamontagne, Department of Fisheries and Oceans.

References

Chabot, Denis, Koenker, Roger and Farrell, Anthony P. (2016) The measurement of the specific dynamic action in fishes. Journal of Fish Biology 88, 152-172.

Chabot, Denis, Steffensen, John F. and Farrell, Anthony P. (2016) The determination of the standard metabolic rate in fishes. Journal of Fish Biology 88, 81-121.

Koenker, Roger (2005) Quantile regression. Cambridge University Press, Cambridge. 366 p.

See Also

calcSDA, plotMO2, text

Examples

 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
data("codSDA")
sda.data = subset(codSDA, r2 >= 0.96)
# Logtime_hr is time in hours relative to time of feeding, a required variable.
# MO2cor is in micromoles per min per kg and the "cor" in the name means that
#    the MO2 values soon after feeding were corrected for the effect of the
#    feeding procedure

SDA= calcSDA(X=sda.data$Logtime_hr, Y=sda.data$MO2cor, my.smr=81.2,
               tau=0.2, lambda=30,
	           postfeed.acclim=3, tol=0.05, tol.type="proportion",
	           MO2.time.unit="min", X.time.unit="hour")

par(mar=c(4, 4, 0.1, 0.1)+0.1, mgp=c(1.8,0.5,0))
plotMO2(sda.data$Logtime_hr, sda.data$MO2cor, mo2="dotital", o2="umol", t="min", m="kg",
    showO2 = FALSE, Xlab = "Time relative to feeding (hr)", ylim=c(50, 250))
plotSDA(SDA)
# not enough space to show the arrow associated with magnitude, better to hide it
plotMO2(sda.data$Logtime_hr, sda.data$MO2cor, mo2="dotital", o2="umol", t="min", m="kg",
    showO2 = FALSE, Xlab = "Time relative to feeding (hr)", ylim=c(50, 250))
plotSDA(SDA, show.mag.arrow=FALSE)

# same data, but focus on post-feeding data and the SDA
plotMO2(sda.data$Logtime_hr, sda.data$MO2cor, mo2="dotital", o2="umol", t="min", m="kg",
    showO2 = FALSE, Xlab = "Time relative to feeding (hr)", ylim=c(50, 250), xlim=c(0,100))
plotSDA(SDA, smr.lab.pos="1L")

# SMR label is illegible, better not to display it
# Default position for peak not great, force a new position
plotMO2(sda.data$Logtime_hr, sda.data$MO2cor, mo2="dotital", o2="umol", t="min", m="kg",
    showO2 = FALSE, Xlab = "Time relative to feeding (hr)", ylim=c(50, 250), xlim=c(0,100))
plotSDA(SDA, smr.lab.pos="none", peak.lab.pos=c(40,150))

denis-chabot/fishMO2 documentation built on July 16, 2020, 1:53 a.m.