Learn R Programming

FSA (version 0.9.5)

tictactoe: Construct a base tic-tac-toe plot for presenting predator-prey PSD values.

Description

Construct a base tic-tac-toe plot for presenting predator-prey PSD values. Predator-prey PSD values are added with plotCI from plotrix.

Usage

tictactoe(
  predobj = c(30, 70),
  preyobj = c(30, 70),
  predlab = "Predator PSD",
  preylab = "Prey PSD",
  obj.col = "black",
  obj.trans = 0.2,
  bnd.col = "black",
  bnd.lwd = 1,
  bnd.lty = 2
)

Value

None. However, a graphic is produced.

Arguments

predobj

A vector of length 2 that contains the target objective range for the predator.

preyobj

A vector of length 2 that contains the target objective range for the prey.

predlab

A string representing a label for the x-axis.

preylab

A string representing a label for the y-axis.

obj.col

A string designating a color to which the target objective regions should be shaded.

obj.trans

A numeric (decimal) that indicates the level of transparency for marking the target objective regions.

bnd.col

A string that indicates a color for the boundaries of the target objective regions.

bnd.lwd

A numeric that indicates the line width for the boundaries of the target objective regions.

bnd.lty

A numeric that indicates the line type for the boundaries of the target objective regions.

IFAR Chapter

6-Size Structure.

Author

Derek H. Ogle, DerekOgle51@gmail.com

Details

This function simply creates a base tic-tac-toe plot. Observed values, with confidence intervals, are added to this plot with plotCI from plotrix; see examples.

References

Ogle, D.H. 2016. Introductory Fisheries Analyses with R. Chapman & Hall/CRC, Boca Raton, FL.

See Also

See psdVal and psdCalc for related functionality.

Examples

Run this code
## Create hypothetical data for plotting one point .. similar to what might come from psdCalc()
prey <- c(45.4,30.2,56.8)
pred <- c(24.5,10.2,36.7)
names(prey) <- names(pred) <- c("Estimate","95% LCI","95% UCI")
prey
pred

tictactoe()
if (require(plotrix)) {
  plotCI(prey[1],pred[1],li=prey[2],ui=prey[3],err="x",pch=16,add=TRUE)
  plotCI(prey[1],pred[1],li=pred[2],ui=pred[3],err="y",pch=16,add=TRUE) 
}

## Create hypothetical data for plotting three points ... similar to what might come from psdCalc()
prey <- rbind(c(45.4,30.2,56.8),
              c(68.2,56.7,79.4),
              c(17.1, 9.5,26.3))
pred <- rbind(c(24.5,10.2,36.7),
              c(14.2, 7.1,21.3),
              c(16.3, 8.2,24.4))
colnames(prey) <- colnames(pred) <- c("Estimate","95% LCI","95% UCI")
prey
pred

tictactoe()
if (require(plotrix)) {
  plotCI(prey[,1],pred[,1],li=prey[,2],ui=prey[,3],err="x",pch=16,add=TRUE)
  plotCI(prey[,1],pred[,1],li=pred[,2],ui=pred[,3],err="y",pch=16,add=TRUE)
}
lines(prey[,1],pred[,1])
text(prey[,1],pred[,1],labels=c(2010,2011,2012),adj=c(-0.5,-0.5))

Run the code above in your browser using DataLab