Commit d546b85a authored by de Freitas Costa, Eduardo's avatar de Freitas Costa, Eduardo
Browse files

graph changes

parent fc56b74b
......@@ -19,7 +19,6 @@ layout(mat = layout.matrix,
widths = c(2, 2)) # Widths of the two columns
for(j in 1:simtable){ # looping Scenarios
set.seed(13)
# All inputs are stored in this file
......@@ -32,7 +31,12 @@ set.seed(13)
nome1<-c("Baseline","Long_OC","Short_Fa", "Short_OC", "Fade_ch=0.5", "Beta_ch=5","Heavy=0.001", "Heavy=0.5", "Cross=0.015","Storage=4days" ,"High Leakage","High_slaugh_contaminaiton","No_farmer-exposure","No_food_consum", "No_far&No_food", "Rate=(0.9,0.5)")
par(mar=c(5,5,4,3))
# png(file=here("Figures", paste("scenario",j,".","png",sep="")), width=600, height=350)
plot(1:times,seq(0,1,length.out = (times)),type="n",
ylab="Prevalence", xlab="Time (Weeks)",xlim=c(1,times),cex=1.2, cex.main=2, cex.lab=2, cex.axis=2,main=paste(nome1[j]))
......@@ -358,11 +362,11 @@ set.seed(13)
dose_chi[t]<-( (10^ready[t])+(10^ready2[t]) )*consu_ch #total dose per contaminated serving (cfu)
dose_veg[t]<-(veg_cross[t]) #total dose per contaminated serving (cfu)
dose_veg[t]<-(veg_cross[t]) #total dose per contaminated serving (cfu)
prev_chi[t]<-(1-exp(-10^dose_chi[t]))*prev_slaug[t] #prevalence based on concentration
prev_chi[t]<-(1-exp(-10^dose_chi[t]))*prev_slaug[t] #prevalence based on concentration
prev_veg[t]<-(1-exp(-dose_veg[t]))*prev_slaug[t] #Prevalence based on concentration
prev_veg[t]<-(1-exp(-dose_veg[t]))*prev_slaug[t] #Prevalence based on concentration
} #end of if steatment
......@@ -387,16 +391,21 @@ set.seed(13)
lines(1:times, Fa, col = "blue")
lines(1:times, H, col = "red")
lines(1:times, media, col = "yellow")
# dev.off()
media_H[iter]<-c(H[times])
} # End of the looping (stochasticity on the time t)
media_H2[j]<-mean(media_H)
}#End of scenarios
par(xpd=NA)
legend(-165,-0.5, legend=c("Ope. Commu.", "Chicken","Farmer","Slaug_prev"),
horiz=TRUE,col=c("red","green", "blue","yellow"), lty=1:1, cex=1.2)
......@@ -406,6 +415,9 @@ saveRDS(media_H2,paste(wd,"/output/cena.rds",sep=""))
cena<-readRDS(paste(wd,"/output/cena.rds",sep=""))
tornado<-function(){
par(mfrow=c(1,1))
base<-cena[1]
......@@ -420,6 +432,7 @@ sorted1<-dado[order(abs(((cena[2:simtable]-base)))),]
saveRDS(sorted,paste(wd,"/output/sorted.rds",sep=""))
saveRDS(sorted1,paste(wd,"/output/sorted1.rds",sep=""))
png(file=here("Figures", "tornado1.png"), width=600, height=350)
par(mar=c(5,13,1,2))
barplot(log(sorted$cena/base), horiz = T,
......@@ -429,8 +442,10 @@ barplot(log(sorted$cena/base), horiz = T,
mtext(side = 1, text = "log difference", line = 3)
#mtext(side = 2, text = "Scenarios", line = 6.5)
dev.off()
png(file=here("Figures", "tornado2.png"), width=600, height=350)
par(mar=c(5,13,1,2))
barplot((sorted1$cena-base), horiz = T,
......@@ -438,7 +453,7 @@ barplot((sorted1$cena-base), horiz = T,
ann = FALSE,xlim=c(min((sorted1$cena-base)),max((sorted1$cena-base))))
axis(side=1, at=seq(-0.002,0.032,0.001), labels = seq(-0.002,0.032,0.001))
mtext(side = 1, text = "Percentage difference", line = 3)
dev.off()
}
......@@ -448,3 +463,43 @@ tornado()
}#end function
human_prev<-list()
prev_diff<-list()
log_diff<-list()
prev<-list()
for (i in 1:16){
human_prev[[i]]<-read.table(paste(here(),"/","Output","/","output_scenario",i,"/","data1.txt",sep=""),header = TRUE)
prev_diff[[i]]<-(human_prev[[i]]$H[[length(human_prev[[i]]$H)]]-
human_prev[[1]]$H[[length(human_prev[[1]]$H)]])
log_diff[[i]]<-log(human_prev[[i]]$H[[length(human_prev[[i]]$H)]]/
human_prev[[1]]$H[[length(human_prev[[1]]$H)]])
prev[[i]]<-human_prev[[i]]$H[[length(human_prev[[i]]$H)]]
}
png(file=here("Figures", "human_prev.png"), width=600, height=350)
par(mar=c(4,4,1,1))
plot(1:200,human_prev[[1]]$H,type="l",col=1,lwd=2,ylab="ESBL prevalence in the open community",xlab="Time in weeks")
lines(1:200,human_prev[[15]]$H,type="l",col=15)
lines(1:200,human_prev[[9]]$H,type="l",col=9)
lines(1:200,human_prev[[14]]$H,type="l",col=14)
lines(1:200,human_prev[[12]]$H,type="l",col=12)
lines(1:200,human_prev[[4]]$H,type="l",col=4)
lines(1:200,human_prev[[5]]$H,type="l",col=5)
lines(1:200,human_prev[[2]]$H,type="l",col=2)
nome2<-c("Baseline","No_far&No_food", "Cross=0.15", "No_food_consum", "High_slaugh_contaminaiton","Short_OC" ,"Fade_ch=0.5" ,"Long_OC" )
legend(130, 0.05, legend=nome2,
col=c(1,15,9,14,12,4,5,2), lty=1,lwd=c(2,1,1,1,1,1,1,1), cex=0.8, text.font=4)
dev.off()
\ No newline at end of file
......@@ -44,38 +44,3 @@ model(10,200,500,16)
human_prev<-list()
prev_diff<-list()
log_diff<-list()
prev<-list()
for (i in 1:16){
human_prev[[i]]<-read.table(paste(here(),"/","Output","/","output_scenario",i,"/","data1.txt",sep=""),header = TRUE)
prev_diff[[i]]<-(human_prev[[i]]$H[[length(human_prev[[i]]$H)]]-
human_prev[[1]]$H[[length(human_prev[[1]]$H)]])
log_diff[[i]]<-log(human_prev[[i]]$H[[length(human_prev[[i]]$H)]]/
human_prev[[1]]$H[[length(human_prev[[1]]$H)]])
prev[[i]]<-human_prev[[i]]$H[[length(human_prev[[i]]$H)]]
}
plot(1:200,human_prev[[1]]$H,type="l",col=1,lwd=2,ylab="ESBL prevalence in the open community",xlab="Time in weeks")
lines(1:200,human_prev[[15]]$H,type="l",col=15)
lines(1:200,human_prev[[9]]$H,type="l",col=9)
lines(1:200,human_prev[[14]]$H,type="l",col=14)
lines(1:200,human_prev[[12]]$H,type="l",col=12)
lines(1:200,human_prev[[4]]$H,type="l",col=4)
lines(1:200,human_prev[[5]]$H,type="l",col=5)
lines(1:200,human_prev[[2]]$H,type="l",col=2)
nome2<-c("Baseline","No_far&No_food", "Cross=0.15", "No_food_consum", "High_slaugh_contaminaiton","Short_OC" ,"Fade_ch=0.5" ,"Long_OC" )
legend(130, 0.05, legend=nome2,
col=c(1,15,9,14,12,4,5,2), lty=1,lwd=c(2,1,1,1,1,1,1,1), cex=0.8, text.font=4)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment