Pacific-salmon-assess / MetricsCOSEWIC

R Package for calculating COSEWIC metrics. Initial focus is on Probability of Decline.
GNU General Public License v3.0
0 stars 2 forks source link

Slope diagnostics #42

Open SOLV-Code opened 3 years ago

SOLV-Code commented 3 years ago

Incorporate another diagnostic plot using RC code from June 2021:


# PLOT

PlotName <- "Upper Adams Population Trends"
UA_trends <- ggplot() +
  geom_point(aes(x=dfPD$Year, y=dfPD$Smoothed), shape=16) +
  geom_line(aes(x=dfPD$Year, y=dfPD$Med), linetype='solid') + 
  geom_line(aes(x=dfPD$Year, y=dfPD$p2.5), linetype='dotdash') +
  geom_line(aes(x=dfPD$Year, y=dfPD$p97.5), linetype='dotdash') +
  scale_x_continuous(breaks= seq(2006,2019,2)) +
  xlab('') + ylab('Mature Individuals (smoothed)') +

  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black")) +
  ggtitle(PlotName)

UA_trends

graphics.off()
dev.new(noRStudioGD=T)
grid.arrange(UA_trends, ncol=1)
dev.copy(pdf,"Plots/UA_trends.pdf")
dev.off()

Screen Shot 06-18-21 at 09 10 AM

SOLV-Code commented 3 years ago

Have a DEV version at the end of this script. It generalizes the inputs and recreates the same layout, but some discussion needed to finalize inputs/options/outputs, then can build into the main functions