Commit b00b7e90 authored by thocro's avatar thocro
Browse files

updated plotting script

parent dce520e6
File added
......@@ -134,32 +134,32 @@ par(mfrow = c(2,3),
mar = c(3, 3, 2, 2),
mgp = c(2, 1, 0))
bxp(f4a,outline=F,xlab="Hours After Sunrise",ylab="MAT (deg.C)",col="White",ylim=c(-1.75,5.25),xaxt="n",varwidth=TRUE)
bxp(f4a,outline=F,xlab="Hours After Sunrise",ylab="MAT (deg.C)",col="White",ylim=c(-1.75,5.25),xaxt="n",varwidth=T)
axis(1,at=seq(1,25,4),labels=seq(0,24,4))
abline(h=c(0),col="Red",lwd=0.75)
title("a)",adj=0)
bxp(f4b,outline=F,xlab="Hours After Sunrise",ylab="MAT (deg.C)",col="White",ylim=c(-1.75,5.25),xaxt="n",varwidth=TRUE)
bxp(f4b,outline=F,xlab="Hours After Sunrise",ylab="MAT (deg.C)",col="White",ylim=c(-1.75,5.25),xaxt="n",varwidth=T)
axis(1,at=seq(1,25,4),labels=seq(0,24,4))
abline(h=c(0),col="Red",lwd=0.75)
title("b)",adj=0)
bxp(f4c,outline=F,xlab="Hours After Sunrise",ylab="MAT (deg.C)",col="White",ylim=c(-3,3),xaxt="n",varwidth=TRUE)
bxp(f4c,outline=F,xlab="Hours After Sunrise",ylab="MAT (deg.C)",col="White",ylim=c(-3,3),xaxt="n",varwidth=T)
axis(1,at=seq(1,25,4),labels=seq(0,24,4))
abline(h=c(-0.2,0,0.2),col=c("DarkRed","Red","DarkRed"),lwd=0.75,lty=c(2,1,2))
title("c)",adj=0)
bxp(f4d,outline=F,xlab="Okta",ylab="MAT (deg.C)",col="White",ylim=c(-3.75,3.75),xaxt="n",varwidth=TRUE)
bxp(f4d,outline=F,xlab="Okta",ylab="MAT (deg.C)",col="White",ylim=c(-3.75,3.75),xaxt="n",varwidth=T)
axis(1,at=seq(1,9),labels=seq(0,8))
abline(h=c(-0.2,0,0.2),col=c("DarkRed","Red","DarkRed"),lwd=0.75,lty=c(2,1,2))
title("d)",adj=0)
bxp(f4e,outline=F,xlab="V (m/s)",ylab="MAT (deg.C)",col="White",ylim=c(-3.75,3.75),xaxt="n",varwidth=TRUE)
bxp(f4e,outline=F,xlab="V (m/s)",ylab="MAT (deg.C)",col="White",ylim=c(-3.75,3.75),xaxt="n",varwidth=T)
axis(1,at=c(1,6,11,16,21,26),labels=c("0","10","20","30","40","50"))
abline(h=c(-0.2,0,0.2),col=c("DarkRed","Red","DarkRed"),lwd=0.75,lty=c(2,1,2))
title("e)",adj=0)
bxp(f4f,outline=F,xlab="Latitude",ylab="MAT (deg.C)",col="White",ylim=c(-3.75,3.75),xaxt="n",varwidth=TRUE)
bxp(f4f,outline=F,xlab="Latitude",ylab="MAT (deg.C)",col="White",ylim=c(-3.75,3.75),xaxt="n",varwidth=T)
axis(1,at=seq(1,13,2),labels=seq(-60,60,20))
abline(h=c(-0.2,0,0.2),col=c("DarkRed","Red","DarkRed"),lwd=0.75,lty=c(2,1,2))
title("f)",adj=0)
......@@ -279,11 +279,11 @@ fixed0_sd <- figure_7data$fixed0_sd
fixed1_sd <- figure_7data$fixed1_sd
f7c <- figure_7data$f7c
p1 <- ggplot(data=figure_7data$coeffs_iter1,aes(x=shiptype_all)) + geom_density(col="DarkGreen",lwd=1.5) + geom_density(data=figure_7data$coeffs_iter0,aes(x=shiptype_all),col="SteelBlue",lwd=1.5) + xlim(c(0,0.0075)) + labs(x="Ratio between heating and cooling terms",y="Density") + ggthemes::theme_few() + theme(plot.margin=grid::unit(c(0,0,0,0), "mm")) + annotate("text",x=min(figure_7data$coeffs_iter0$shiptype_all),y=600,label="a)") + theme(panel.border = element_blank(),axis.line=element_line(colour = "Black"))
p1 <- ggplot(data=figure_7data$coeffs_iter1,aes(x=shiptype_all)) + geom_density(col="DarkGreen",lwd=1.5) + geom_density(data=figure_7data$coeffs_iter0,aes(x=shiptype_all),col="SteelBlue",lwd=1.5) + scale_x_continuous(limits = c(0,0.0075),expand = c(0,0)) + labs(x="Ratio between heating and cooling terms",y="Density") + ggthemes::theme_few() + theme(plot.margin=grid::unit(c(0,0,0,0), "mm")) + annotate("text",x=0.00025,y=600,label="a)") + theme(panel.border = element_blank(),axis.line=element_line(colour = "Black"))
p2 <- ggplot() + geom_ribbon(data=fixed0_mean,aes(x=seq(1,24),y=fixed0_mean,ymin=fixed0_mean - fixed0_sd$fixed0_sd,ymax=fixed0_mean + fixed0_sd$fixed0_sd),alpha=0.2,fill="SteelBlue") + geom_ribbon(data=fixed1_mean,aes(x=seq(1,24),y=fixed1_mean,ymin=fixed1_mean - fixed1_sd$fixed1_sd,ymax=fixed1_mean + fixed1_sd$fixed1_sd),alpha=0.2,fill="DarkGreen") +scale_x_continuous(breaks = seq(1,23,4),labels = c("8", "12", "16", "20", "0","4")) + geom_line(data=fixed0_mean,aes(x=seq(1,24),y=fixed0_mean),col="SteelBlue") + geom_line(data=fixed1_mean,aes(x=seq(1,24),y=fixed1_mean),col="DarkGreen") + labs(x="Local Hour",y=expression(paste(Delta,T[BKT]))) + ggthemes::theme_few() + theme(plot.margin=grid::unit(c(0,0,0,0), "mm")) + annotate("text",x=1,y=2.35,label="b)") + theme(panel.border = element_blank(),axis.line=element_line(colour = "Black"))
p3 <- ggplot(f7c,aes(x=as.POSIXct(date,format="%m/%d/%Y %H:%M:%S",tz="GMT"),y=aterr_nightmean_lag1_climdt)) + geom_line() + geom_ribbon(aes(x=as.POSIXct(date,format="%m/%d/%Y %H:%M:%S",tz="GMT"),y=dmat_adj,ymax=dmat_adj+dmat_sd,ymin=dmat_adj-dmat_sd),fill="DarkGreen",alpha=0.4) + geom_ribbon(aes(x=as.POSIXct(date,format="%m/%d/%Y %H:%M:%S",tz="GMT"),y=dmat_adj,ymax=dmat_adj+dmat_sd*2,ymin=dmat_adj-dmat_sd*2),fill="DarkGreen",alpha=0.2) + geom_line(aes(x=as.POSIXct(date,format="%m/%d/%Y %H:%M:%S",tz="GMT"),y=dmat_adj),col="DarkGreen") + ggthemes::theme_few() + labs(x="Day",y=expression(MAT[adj])) + scale_x_datetime(date_breaks = "2 days",date_labels = "%d") + theme(plot.margin=grid::unit(c(0,0,0,0), "mm")) + annotate("text",x=min(f7c$date),y=max(f7c$dmat_adj+ f7c$dmat_sd *2),label="c)") + theme(panel.border = element_blank(),axis.line=element_line(colour = "Black"))
p3 <- ggplot(f7c,aes(x=as.POSIXct(date,format="%m/%d/%Y %H:%M:%S",tz="GMT"),y=aterr_nightmean_lag1_climdt)) + geom_line(lty=2) + geom_ribbon(aes(x=as.POSIXct(date,format="%m/%d/%Y %H:%M:%S",tz="GMT"),y=dmat_adj,ymax=dmat_adj+dmat_sd,ymin=dmat_adj-dmat_sd),fill="DarkGreen",alpha=0.4) + geom_ribbon(aes(x=as.POSIXct(date,format="%m/%d/%Y %H:%M:%S",tz="GMT"),y=dmat_adj,ymax=dmat_adj+dmat_sd*2,ymin=dmat_adj-dmat_sd*2),fill="DarkGreen",alpha=0.2) + geom_line(aes(x=as.POSIXct(date,format="%m/%d/%Y %H:%M:%S",tz="GMT"),y=dmat_adj),col="DarkGreen") + geom_line(aes(x=as.POSIXct(date,format="%m/%d/%Y %H:%M:%S",tz="GMT"),y=dmat_adj_first),col="SteelBlue") + ggthemes::theme_few() + labs(x="Day",y=expression(paste(Delta,T[BKT]," | ",Delta,T[err]))) + scale_x_datetime(date_breaks = "2 days",date_labels = "%d",expand = c(0.01,0.01)) + theme(plot.margin=grid::unit(c(0,0,0,0), "mm")) + annotate("text",x=f7c$date[2],y=max(f7c$dmat_adj+ f7c$dmat_sd *2),label="c)") + theme(panel.border = element_blank(),axis.line=element_line(colour = "Black"))
pdf("Figure_7.pdf",width=9,height=4)
#cowplot::plot_grid(cowplot::plot_grid(p1,p2,p3,p4,nrow=2,align = "hv"))
cowplot::plot_grid(cowplot::plot_grid(p1,p2,nrow=1),p3,nrow=2)
dev.off()
rm(figure_7data,fixed1_sd,fixed0_sd,fixed1_mean,fixed0_mean,f7c)
rm(figure_7data,fixed1_sd,fixed0_sd,fixed1_mean,fixed0_mean,f7c)
\ No newline at end of file
Markdown is supported
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