This document describe the steps to plot the Elkhorn Slough model results. These are biomass estimations by the model.
Load data
The first thing you need to do is load your data in R. We create a datatable called and we fill it with data from the csv file called An example data can be downloaded from this link
mass<-read.csv('Biomass_annual.csv', header=T)
Take a look at data
Now we want to make sure that the data looks ok. With the following code, you can take a look at the dimentions of the data. This is useful to double check all functional groups and all years are there.
dim(mass)
## [1] 31 23
With the following we can see the years and functional groups we are working with
years<-unique(mass$Year); years
## [1] 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002 2001 2000
## [15] 1999 1998 1997 1996 1995 1994 1993 1992 1991 1990 1989 1988 1987 1986
## [29] 1985 1984 1983
fg<-colnames(mass); fg
## [1] "Year" "Sea.otter" "Leopard.shark"
## [4] "Staghorn.sculpin" "Stickleback" "Pipefish"
## [7] "Arrow.goby" "Perch" "Flatfish"
## [10] "Bat.ray" "Cancer.Crab" "Other.Crab"
## [13] "Bivalve" "Polychaeta" "Isopod"
## [16] "Gastropod" "Amphipod" "Zooplankton"
## [19] "Phytoplankton" "Epiflora" "Zostera"
## [22] "Ulva" "Detritus"
Set plot dimentions
First, we set the dimensions of the plot and the number of plots
par(mfrow=c(6,4), mar=c(0.2,1,1,0.5), oma=c(4,3,0,1), xpd=TRUE, cex=.5)
Plot data
Plot each of the functional grups following the example for the southern sea otter
par(mfrow=c(6,4), mar=c(0.2,2,1,0.5), oma=c(4,3,0,1), xpd=TRUE, cex=.5)
plot(mass$Year, mass$Sea.otter, main="southern sea otter", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Leopard.shark, main="Leopard shark", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Staghorn.sculpin, main="Staghorn sculpin", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Stickleback, main="Stickleback", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Pipefish, main="Pipefish", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Arrow.goby, main="arrow goby", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Stickleback, main="Staghorn sculpin", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Perch, main="perch", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Flatfish, main="Flatfish", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Bat.ray, main="bat ray", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Cancer.Crab, main="Cancer.Crab", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Other.Crab, main="Other.Crab", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Bivalve, main="Bivalve", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Polychaeta, main="Polychaeta", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Isopod, main="Isopod", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Gastropod, main="Gastropod", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Amphipod, main="Amphipod", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Zooplankton, main="Zooplankton", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Phytoplankton, main="Phytoplankton", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Epiflora, main="Epiflora", ylab="Biomass", xlab="Year", xaxt="n",col="Black", type="l")
plot(mass$Year, mass$Zostera, main="Zostera", ylab="Biomass", xlab="Year",col="Black", type="l")
plot(mass$Year, mass$Ulva, main="Ulva", ylab="Biomass", xlab="Year",col="Black", type="l")
plot(mass$Year, mass$Detritus, main="Detritus", ylab="Biomass", xlab="Year",col="Black", type="l")
# General Axis
mtext("Biomass (tons/square Km)", side= 2, outer=TRUE, line= 1)
mtext("Year", side= 1, outer=TRUE, line= 2)