diff --git a/plotting/panel.R b/plotting/panel.R
index fdd8723559f5f407d87535b78623c683677c6800..3c601b1ec15b288396648892d941752c86565aa2 100644
--- a/plotting/panel.R
+++ b/plotting/panel.R
@@ -1,59 +1,89 @@
 # Usefull library
 library(ggplot2)
+library(qpdf)
 library(gridExtra)
 
-width = 30
-height = 14
-dpi = 100
 
 # Time panel
-panel = function (df_data, df_info, figdir, filedir, is_sqrt=FALSE) {
+panel = function (df_data, df_meta, figdir, p_threshold=0.1, filedir_opt='', filename_opt='', variable='', df_trend=NULL, unit2day=365.25, is_sqrt=FALSE) {
 
     outfile = "Panels"
+    
+    if (filename_opt != '') {
+        outfile = paste(outfile, '_', filename_opt, sep='')
+    }
 
     if (is_sqrt) {
         df_data[, 'Qm3s'] = apply(df_data[, 'Qm3s'], 1, sqrt)
         outfile = paste(outfile, '_sqrt', sep='') 
-    }
-    
+    }    
+
     outfile = paste(outfile, '.pdf', sep='')
 
     # If there is not a dedicated figure directory it creats one
-    outdir = file.path(figdir, filedir, sep='')
+    outdir = file.path(figdir, filedir_opt, sep='')
     if (!(file.exists(outdir))) {
         dir.create(outdir)
     }
+
+    outdirTmp = file.path(outdir, 'tmp')
+    if (!(file.exists(outdirTmp))) {
+        dir.create(outdirTmp)
+    }
     
     # Get all different stations code
-    Code = levels(factor(df_info$code))
-
-    # Create a blank list in order to store plots
-    plots = list()
+    Code = levels(factor(df_meta$code))
 
     for (code in Code) {
+        
         # Print code of the station for the current plotting
         print(paste("Plotting for sation :", code))
+        df_data_code = df_data[df_data$code == code,] 
+
+        dDate = df_data_code$Date[length(df_data_code$Date)] -
+            df_data_code$Date[1]
+        datebreak = round(as.numeric(dDate) / unit2day / 12 , 0)
         
-        df_data_code = df_data[df_data$code==code,] 
-        # df_data_code_NoNA = df_data_code[!is.na(df_data_code$Qm3s),]
-        
-        # Plot
-        p = ggplot(df_data_code, aes(x=Date, y=Qm3s)) +
-            geom_line()
+        p = ggplot() +
+            geom_line(aes(x=df_data_code$Date, y=df_data_code$Qm3s),
+                      color='black')
+
+        if (!is.null(df_trend)) {
+            if (df_trend[df_trend$code == code,]$p < p_threshold) {
+
+                abs = c(df_data_code$Date[1],
+                        df_data_code$Date[length(df_data_code$Date)])
 
-        # Store
-        plots = append(plots, list(p))
+                abs_num = as.numeric(abs)/unit2day
+
+                ord = abs_num * df_trend$trend[df_trend$code == code] +
+                    df_trend$intercept[df_trend$code == code]
+
+                p = p + 
+                    geom_line(aes(x=abs, y=ord), 
+                              color='cornflowerblue')
+        }}
         
-    }
+        p = p + 
+            ggtitle(paste(variable, 'station', 
+                          as.character(code), sep=' ')) +
+            ylab(expression(paste('débit [', m^{3}, '.', 
+                                  s^{-1}, ']', sep=''))) +
+            xlab('date') + 
+            scale_x_date(date_breaks=paste(as.character(datebreak), 'year', sep=' '), date_labels="%Y")
 
-    # Saving
-    ggsave(path=outdir,
-           filename=outfile, 
-           plot=marrangeGrob(plots, nrow=1, ncol=1), 
-           width=29.7, height=21, units='cm', dpi=100
-    )
+        # Saving
+        ggsave(path=outdirTmp,
+               filename=paste(as.character(code), '.pdf', sep=''),
+               width=29.7, height=21, units='cm', dpi=100)
 
+    }
+    # print(list.files(outdirTmp))
+    print(file.path(outdir, outfile))
 
+    pdf_combine(input=file.path(outdirTmp, list.files(outdirTmp)),
+                output=file.path(outdir, outfile))
+    unlink(outdirTmp, recursive=TRUE)
 } 
 
 
diff --git a/processing/format.R b/processing/format.R
index d5ddb597bbc57defd69b6f285fd73774eff0f36f..c7cbe0abdef18a9883448980bbf69f68f36c0824 100644
--- a/processing/format.R
+++ b/processing/format.R
@@ -83,6 +83,13 @@ clean = function (df_Xtrend, df_XEx, df_Xlist) {
 
     df_Xlist = reprepare(df_XEx, df_Xlist, colnamegroup=c('code'))
 
+    df_Xlist$data$code = NA
+    for (g in df_Xlist$info$group) {
+        df_Xlist$data$code[which(df_Xlist$data$group == g)] = df_Xlist$info$code[df_Xlist$info$group == g]
+    }
+    
+    # df_Xlist$data = df_Xlist$data[, !names(df_Xlist$data) == "group")]
+
     df_Xtrend = bind_cols(df_Xtrend,
                           df_Xlist$info[df_Xtrend$group1,
                                        2:ncol(df_Xlist$info)])
diff --git a/script.R b/script.R
index 386ec84aa7da64e46a696a815d96ebedf18cf2a1..e02c8e289f746dd477529ef9e4994046d8f5cfc1 100644
--- a/script.R
+++ b/script.R
@@ -23,7 +23,7 @@ BHfiledir =
 # Name of the file that will be analysed from the BH directory
 BHfilename =
     # ""
-    c("H5920011_HYDRO_QJM.txt")#, "K4470010_HYDRO_QJM.txt")
+    c("H5920011_HYDRO_QJM.txt", "K4470010_HYDRO_QJM.txt")
     # "all"
 
 ## Or list selection ##
@@ -151,9 +151,18 @@ df_meta = df_join$meta
 
 # QA TREND #
 res_QAtrend = get_QAtrend(df_data, period)
+panel(df_data=res_QAtrend$data, 
+      df_meta=df_meta,
+      df_trend=res_QAtrend$trend,
+      p_threshold=0.1,
+      figdir=figdir, filedir_opt='QA', variable='QA')
 
 # QMNA TREND #
 # res_QMNAtrend = get_QMNAtrend(df_data, period)
 
 # VCN10 TREND #
-res_VCN10trend = get_VCN10trend(df_data, df_meta, period)
+# res_VCN10trend = get_VCN10trend(df_data, df_meta, period)
+# panel(df_data=res_VCN10trend$data, 
+#       df_meta=df_meta,
+#       df_trend=res_VCN10trend$trend,
+#       figdir=figdir, filedir="VCN10")
diff --git a/script_install.R b/script_install.R
index b1383666477110d139b05c656a23e944bf9071fd..b520c2c24389cb7adce0edbc476ea9e40f20cde0 100644
--- a/script_install.R
+++ b/script_install.R
@@ -7,6 +7,7 @@ install.packages("ggplot2")
 install.packages("officer")
 install.packages("lubridate")
 install.packages('zoo')
+install.packages("qpdf")
 
 library(devtools)
 install_github("https://github.com/benRenard/BFunk") #type '1'