# Minnows per km barplot over discharge at ABQ gauge
#read in annual catch data from 2009-present. This table is updated each year using the summary tab on the Fish Rescue database
read.csv("Adult.marked.yoy.csv")-> annual_dat
#standardize each count by number of rkm recued
annual_dat[,2:4] <- annual_dat[,2:4]/annual_dat[,5]
annual_dat <- t(annual_dat)
#colors for the plot
colors=c("white","grey85","grey55")
#~~~create plot~~~#
###*to update annually, add in the new axis references on line 139 (row # from the discharge table for January 1 of that year) and add a new "Jan XXXX" label on line 141*###
#jpeg(filename="yoyadultgrey4.jpg", units="in", quality=100, width=6, height=8, res=600)
{
par(mar=c(1,5,4,1), mfrow = c(2,1), cex.axis=1.25,cex.lab=1.5,cex.main=1.25)
barplot(as.matrix(annual_dat[2:4,]+1),
axes=TRUE,
axisnames=(TRUE),
col=rev(colors),
border=T,
xlab="",
ylab="",
names.arg=annual_dat[1,],
cex.names=1,
ylim=c(1,5000),
log="y",
las=1
)
abline(h = mean(annual_dat[2:4,]), col = "red")
mtext(side=2, line=3, cex=1.5, "RGSM per km", las=0)
#added average catch line
legend(x=0, y=6500, cex=1.5,
fill=(colors), legend=c("YOY", "Hatchery", "Adult"),
border="black", ncol=1, bty = "n")
box(bty="l", lwd=2)
par(mar = c(4,5,1,1), font = 2, cex.axis=1.25,cex.lab=1.5,cex.main=1.25)
plot(discharge.ABQ$Date,
discharge.ABQ$q/35.315, type = "h",
xlab = "Year", ylab = "", axes = FALSE)
label_position <- discharge.ABQ$Date[round(seq(1,length(annual_dat[1,]))*365.25)]
label_names <-min(year(discharge.ABQ$Date)):max(year(discharge.ABQ$Date))
axis(1, at=label_position, labels=label_names)
axis(2, las = 1)
mtext(expression(paste("Discharge (", m^3, "/s)")), side = 2, line = 3,
cex = 1.5, adj = 0.5, las = 0)
box(bty = "l", lwd = 2)
}