Project

General

Profile

« Previous | Next » 

Revision 52b97ce7

Added by Benoit Parmentier about 10 years ago

revisions2 multitime scale paper, modifications to functions scrip

View differences:

climate/research/oregon/interpolation/multi_timescales_paper_interpolation_functions.R
5 5
#Functions used in the production of figures and data for the multi timescale paper are recorded.
6 6
#AUTHOR: Benoit Parmentier                                                                      #
7 7
#DATE CREATED: 11/25/2013            
8
#DATE MODIFIED: 08/12/2014            
8
#DATE MODIFIED: 10/06/2014            
9 9
#Version: 5
10 10
#PROJECT: Environmental Layers project                                       #
11 11
#################################################################################################
......
30 30

  
31 31
#### FUNCTION USED IN SCRIPT
32 32

  
33
function_analyses_paper <-"multi_timescales_paper_interpolation_functions_05052014.R"
33
function_analyses_paper <-"multi_timescales_paper_interpolation_functions_10062014.R"
34 34

  
35 35
create_dir_fun <- function(out_dir,out_suffix){
36 36
  if(!is.null(out_suffix)){
......
122 122
      m<-match(k,m_layers)
123 123
      
124 124
      if (k==1 & is.na(m)){
125
        par(mar = c(5,5,2,5)) #added 10/06
125 126
        plot(x,y,type="l",xlab="transect distance from coastal origin (km)", ylab=" maximum temperature (degree C)",
126 127
             ylim=y_range,cex=1.2,col=t_col[k])
127 128
        #axis(2)
128 129
      }
129 130
      if (k==1 & !is.na(m)){ #if layer sc (i.e. ellevation then plot on another scale)
131
        par(mar = c(5,5,2,5))
130 132
        plot(x,y,type="l",col=t_col[k],lty="dotted",axes=F) #plotting fusion profile
131 133
        #axis(4,xlab="",ylab="elevation(m)")  
132 134
        axis(4,cex=1.2)
......
138 140
      }
139 141
      if (k!=1 & !is.na(m)){
140 142
        par(new=TRUE)              # key: ask for new plot without erasing old
143
        par(mar = c(5,5,2,5)) #adjust margin to give space for right side labels for axes
141 144
        plot(x,y,type="l",col=t_col[k],xlab="",ylab="",lty="dotted",axes=F) #plotting fusion profile
142 145
        #axis(4,xlab="",ylab="elevation(m)")  
143 146
        axis(4,cex=1.2)
......
148 151
           cex=1.2, col=t_col,lty=1,bty="n")
149 152
    legend("topright",legend=names(r_stack)[m_layers], 
150 153
           cex=1.2, col=t_col[3],lty="dotted",bty="n")
154
    mtext(side = 4, line = 3, "Elevation (m)")
151 155
    if (disp==TRUE){
152 156
      savePlot(file=paste(list_trans[[i]][2],".png",sep=""),type="png")
153 157
    }
......
656 660
    p1 <- levelplot(var_background,scales = list(draw = FALSE), colorkey = FALSE,par.settings = GrTheme)
657 661
    df_tmp=subset(data_v_mae,data_v_mae[[res_model_name]]!="NaN")
658 662
  
659
    p2 <- bubble(df_tmp,res_model_name, main=paste("Average MAE per station for ",model_name," ",interp_method, sep=""),
660
               na.rm=TRUE)
663
    #p2 <- bubble(df_tmp,res_model_name, main=paste("Average MAE per station for ",model_name," ",interp_method, sep=""),
664
    #          na.rm=TRUE)
665
    temp.colors <- colorRampPalette(c('blue', 'khaki', 'red'))
666
    p2<- spplot(df_tmp[res_model_name],col.regions=temp.colors(5),
667
                main=list(label=paste("Average MAE per station for ",model_name," ",interp_method, sep=""),cex=1.5),
668
                cex=sqrt(1:5)*1.5,key.space="right", 
669
                auto.key=list(space = "right", cex=1.1,font=2))#,
670
                #na.rm=T)
671
    
661 672
    p3 <- p2 + p1 + p2 #to force legend...
662 673
    list_p_mae[[k]] <- p3
663 674
    

Also available in: Unified diff