diff --git a/plotting/panel.R b/plotting/panel.R
index 195652bdb9b0c5853d8e5d4dc7e28d72de87d4d7..e446296fd9c8b2fb6cc45a84c1e2203ac889922e 100644
--- a/plotting/panel.R
+++ b/plotting/panel.R
@@ -104,6 +104,8 @@ panel = function (df_data, df_meta, layout_matrix, figdir='', filedir_opt='', fi
             P[[2]] = Htime
         }
 
+
+        nbcol = ncol(as.matrix(layout_matrix))
         for (i in 1:nbp) {
             df_data = list_df2plot[[i]]$data
             df_trend = list_df2plot[[i]]$trend
@@ -111,24 +113,33 @@ panel = function (df_data, df_meta, layout_matrix, figdir='', filedir_opt='', fi
             unit2day = list_df2plot[[i]]$unit2day
             missRect = list_df2plot[[i]]$missRect
             type = list_df2plot[[i]]$type
-
+            
             p = time_panel(code, df_data, df_trend, missRect,
-                           p_threshold, unit2day, type)
+                           p_threshold, unit2day, type,
+                           last=(i > nbp-nbcol))
 
             P[[i+nbh]] = p
 
         }
         
-        layout_matrix_H = as.matrix(layout_matrix + nbh)
+        layout_matrix = as.matrix(layout_matrix)
+        nel = nrow(layout_matrix)*ncol(layout_matrix)
+
+        ##
+        idNA = which(is.na(layout_matrix), arr.ind=TRUE)
+
+        layout_matrix[idNA] = seq(max(layout_matrix, na.rm=TRUE) + 1,
+                                  max(layout_matrix, na.rm=TRUE) + 1 +
+                                  nel)
+        ##
+
+        layout_matrix_H = layout_matrix + nbh
 
-        print(layout_matrix_H)
 
         LM = c()
         LMcol = ncol(layout_matrix_H)
         LMrow = nrow(layout_matrix_H)
         for (i in 1:(LMrow+nbh)) {
-            
-            print(i)
 
             if (i <= nbh) {
                 LM = rbind(LM, rep(i, times=LMcol))
@@ -137,36 +148,11 @@ panel = function (df_data, df_meta, layout_matrix, figdir='', filedir_opt='', fi
                            matrix(rep(layout_matrix_H[i-nbh,],
                                       times=header_ratio),
                                   ncol=LMcol, byrow=TRUE))
-            }
-        }
-
-        print(nbg)
-        print(LM)
+            }}
 
         plot = grid.arrange(grobs=P, layout_matrix=LM)
-
-
-        # if (nbnh <= 4) {
-        #     plot = grid.arrange(grobs=P,
-        #                         heights=c(rep(1/(nbnh*ratio + nbh), 
-        #                                       nbh),
-        #                                   rep(ratio/(nbnh*ratio + nbh),
-        #                                       nbnh)),
-        #                         ncol=1, nrow=nbg)
-
-        # } else if (nbnh > 4) {
-        #     P[[(length(P)+1):8]] = void
-        #     plot = grid.arrange(grobs=P, 
-        #                         heights=c(rep(1/((nbg-2)*2+2), 1),
-        #                                   rep(2/((nbg-2)*2+2), nbg-2)), 
-        #                         ncol=1, nrow=nbg)
-
-        # }
-
-            # } else if (nbg-2 <= 6 & nbg-2 > 3) {
-            #     
-
-            # }
+        
+        # plot = grid.arrange(rbind(cbind(ggplotGrob(P[[2]]), ggplotGrob(P[[2]])), cbind(ggplotGrob(P[[3]]), ggplotGrob(P[[3]]))), heights=c(1/3, 2/3))
         
 
         # Saving
@@ -187,7 +173,7 @@ panel = function (df_data, df_meta, layout_matrix, figdir='', filedir_opt='', fi
 
 
 
-time_panel = function (code, df_data, df_trend, missRect, p_threshold, unit2day, type) {
+time_panel = function (code, df_data, df_trend, missRect, p_threshold, unit2day, type, last=FALSE) {
     
     if (type == 'sqrt') {
         df_data[, 'Qm3s'] = apply(df_data[, 'Qm3s'], 1, sqrt)
@@ -244,9 +230,13 @@ time_panel = function (code, df_data, df_trend, missRect, p_threshold, unit2day,
                      date_labels="%Y",
                      limits=c(min(df_data_code$Date), 
                               max(df_data_code$Date)),
-                     expand=c(0, 0)) 
-    
-    if (type == 'sqrt') {
+                     expand=c(0, 0)) +
+        annotate('text', 
+                 x=as.Date(as.numeric(max(df_data_code$Date))*0.9),
+                 y=max(df_data_code$Qm3s, na.rm=TRUE)*1.05, 
+                 label=type)
+        
+    if (type == 'sqrt') {   
         p = p +
             scale_y_continuous(breaks=seq(0, 100, 10),
                                minor_breaks=seq(0, 100, 5),
@@ -270,11 +260,18 @@ time_panel = function (code, df_data, df_trend, missRect, p_threshold, unit2day,
                                 expand=c(0, 0))
     }
 
-    # if 
-    p = p +
-        theme(
-            panel.background=element_rect(fill="white"),
-            plot.margin=margin(0.25, 5, 0.25, 5, unit="mm"))
+    if (last) {
+        p = p +
+            theme(
+                panel.background=element_rect(fill="white"),
+                plot.margin=margin(1, 5, 5, 5, unit="mm"))
+    } else {
+        p = p +
+            theme(
+                panel.background=element_rect(fill="white"),
+                plot.margin=margin(1, 5, 1, 5, unit="mm"))
+        
+    }
 
     return(p)
 }
diff --git a/script.R b/script.R
index 10ed2331e5803c826aa869fc960e205ff5535a2b..73f0985f317398c4e541f49c2c5f083b62091a65 100644
--- a/script.R
+++ b/script.R
@@ -155,30 +155,30 @@ res_VCN10trend = get_VCN10trend(df_data, df_meta, period)
 
 # TIME PANEL #
 # Plot time panel of debit by stations
-# panel(list(df_data, df_data),
-#       layout_matrix=c(1, 2),
-#       df_meta=df_meta,
-#       missRect=list(TRUE, TRUE), 
-#       type=list('time', 'sqrt'), 
-#       info_header=TRUE,
-#       time_header=NULL,
-#       header_ratio=3,
-#       figdir=figdir,
-#       filename_opt='time')
-
-panel(list(res_QAtrend$data, res_QMNAtrend$data,
-           res_VCN10trend$data), 
-      layout_matrix=matrix(c(1, 2, 3, 3), ncol=2, byrow=TRUE),
-      df_meta=df_meta, 
-      df_trend=list(res_QAtrend$trend, res_QMNAtrend$trend,
-                    res_VCN10trend$trend), 
-      type=list('', '', ''),
-      missRect=list(TRUE, TRUE, TRUE),
+panel(list(df_data, df_data),
+      layout_matrix=c(1, 2),
+      df_meta=df_meta,
+      missRect=list(TRUE, TRUE), 
+      type=list('time', 'sqrt'), 
       info_header=TRUE,
-      time_header=df_data,
-      header_ratio=2,
+      time_header=NULL,
+      header_ratio=3,
       figdir=figdir,
-      filename_opt='')
+      filename_opt='time')
+
+# panel(list(res_QAtrend$data, res_QMNAtrend$data,
+#            res_VCN10trend$data), 
+#       layout_matrix=c(1, 2, 3),
+#       df_meta=df_meta, 
+#       df_trend=list(res_QAtrend$trend, res_QMNAtrend$trend,
+#                     res_VCN10trend$trend), 
+#       type=list(expression(Q_A), '', ''),
+#       missRect=list(TRUE, TRUE, TRUE),
+#       info_header=TRUE,
+#       time_header=df_data,
+#       header_ratio=2,
+#       figdir=figdir,
+#       filename_opt='')
 
 ### /!\ Removed 185 row(s) containing missing values (geom_path) -> remove NA ###