# options to create final publication quality figures
# causes the document to fail, but the figs do get stored in figs/
library(knitr)
opts_chunk$set(dev="tiff",
               dev.args=list(compression="lzw"),
               dpi=300,
               cache=FALSE,
               fig.path='figs/')
  library(resistance)
  library(ggplot2)
plot_fit_calc( simple=TRUE, effectiveness=0.8, resistance_restoration=0.5, dominance_restoration=0.6, dominance_cost=0.6, cost=0.3 )

Screenshot of one online model user interface, accessible at : <https://andysouth.shinyapps.io/resistmob2/>. The user can modify values of the input parameters considered in this paper using simple sliders and run the model to get graphs of resulting resistance frequency over time. Two scenarios (A and B) can be run and the results viewed side by side. This makes it easy to explore the effect of changing individual inputs.

TODO decide which of later figures to modify for pubhealth J paper

#2 panel fig A. sequence better, B. mix better

#eff1  0.4  0.8

# add side panels for labels
#layout( matrix(c(1:6,0,7,7,0,8,9),4,3, byrow = TRUE), heights=c(1,1,0.15,0.2), widths=c(0.1,1,1) )

layout( matrix(c(1:2,3,3),2,2, byrow = TRUE), heights=c(1,0.15), widths=c(1,1) )
#layout.show(n=3)


#eff1 0.4 seq better

#plot margins, hight t just a bodge to get graphs down closer to legend
par(mar=c(1.5, 4, 15, 0)) #b,l,t,r default c(5, 4, 4, 2)

runcurtis_f2( max_gen=500,  P_1 = 0.01 , P_2 = 0.01 , h.RS1_A0 = 0.5 , h.RS2_0B = 0.5 , exposure = 0.5 , phi.SS1_A0 = 0.4 , phi.SS2_0B = 0.5 , rr_restoration_ins1 = 0.5 , rr_restoration_ins2 = 0.5 , addCombinedStrategy = FALSE, strategyLabels = c('s','','a','m'), xlabs = TRUE, cex.axis = 0.8, addLegend=FALSE, main='', maxX = 140, labelMixSeqRatio = 1 )

mtext('A.',side=3, adj=0, line=1, cex=0.9) #side=1b,2l,3t,4r

#plot margins, hight t just a bodge to get graphs down closer to legend
par(mar=c(1.5, 4, 15, 0)) #b,l,t,r default c(5, 4, 4, 2)

#eff1 0.8 mix better
runcurtis_f2( max_gen=500,  P_1 = 0.01 , P_2 = 0.01 , h.RS1_A0 = 0.5 , h.RS2_0B = 0.5 , exposure = 0.5 , phi.SS1_A0 = 0.8 , phi.SS2_0B = 0.5 , rr_restoration_ins1 = 0.5 , rr_restoration_ins2 = 0.5 , addCombinedStrategy = FALSE, strategyLabels = c('s','','a','m'), ylab="", ylabs = FALSE, xlabs = TRUE, cex.axis = 0.8, addLegend=FALSE, main='', maxX = 140, labelMixSeqRatio = 1 )

mtext('B.',side=3, adj=0, line=1, cex=0.9) #side=1b,2l,3t,4r


#adding legend in lower panel
#plot margins
par(mar=c(0, 0, 0, 0), pty='m') #b,l,t,r default c(5, 4, 4, 2)

plot( 0, type="n", axes=FALSE, ann=FALSE, pty='m') 

legend( 'bottom', inset=0.1, legend=c("insecticide1 alone   ", "insecticide2 alone   ", "insecticide1 in mix   ", "insecticide2 in mix   "), col=c("red","blue","red","blue"), lty=c(2,2,1,1), pch=c(NA,NA,NA,NA), bty="n", cex=0.9, horiz =TRUE )


AndySouth/resistance documentation built on Nov. 12, 2020, 3:39 a.m.