From cb178083e9206af976358b2a09aa33beb1b01d01 Mon Sep 17 00:00:00 2001
From: Jacques Grelet <jacques.grelet@ird.fr>
Date: Thu, 5 Jul 2018 15:04:04 +0000
Subject: [PATCH] comment axes and use it as first parameter of line
 line(hPlotAxes(i), ...

---
 tsg_util/plot_Climatology.m | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/tsg_util/plot_Climatology.m b/tsg_util/plot_Climatology.m
index a3861e8..f41a6b1 100644
--- a/tsg_util/plot_Climatology.m
+++ b/tsg_util/plot_Climatology.m
@@ -70,33 +70,38 @@ for i = 1:2
     continue
   end
   
+  % for a valid parameter, plot climatology
+  % --------------------------------------
   if para
-    meanc = zeros(size(dayd));
-    stdc  = zeros(size(dayd));
+    
+    % prepare the interpolation
+    % ---------------------------
     latc = tsg.levitus.data.WOA_LATX;
     lonc = tsg.levitus.data.WOA_LONX;
     clim = tsg.levitus.data.(['WOA_MEAN_' para]);
+    % remove sigleton dimension
     clim = squeeze(clim(time_dim,depth,:,:));
+    % interpolation for 2-D gridded
     meanc = interp2(lonc,latc,clim,lon,lat);
-    
+    % same for standard deviation
     sclim = tsg.levitus.data.(['WOA_STD_' para]);
     sclim = squeeze(sclim(time_dim,depth,:,:));
     stdc = interp2(lonc,latc,sclim,lon,lat);
     
     % Select the axes
     % ---------------
-    axes( hPlotAxes(i) );
+    %axes( hPlotAxes(i) );
     
     % Plot mean salinity climatology
     % ------------------------------
-    line(dayd, meanc, ...
+    line(hPlotAxes(i), dayd, meanc, ...
       'Tag', ['TAG_LINE_CLIMATO_MEAN_' para], 'Linestyle', '-', 'Color','k');
     
     % Plot with 3 standard deviation
     % ------------------------------
-    line(dayd,  meanc + 3 * stdc, ...
+    line(hPlotAxes(i), dayd,  meanc + 3 * stdc, ...
       'Tag', ['TAG_LINE_CLIMATO_STDDEV_PLUS_' para], 'Linestyle', '-', 'Color','r');
-    line(dayd,  meanc - 3 * stdc, ...
+    line(hPlotAxes(i), dayd,  meanc - 3 * stdc, ...
       'Tag', ['TAG_LINE_CLIMATO_STDDEV_MINUS_' para], 'Linestyle', '-', 'Color','r');
     
     % Plot marker if climatological value has no neighbour
@@ -104,11 +109,11 @@ for i = 1:2
     indnon=find(isfinite([meanc',nan]) & isnan(circshift([meanc',nan],[0 1]))...
       & isnan(circshift([meanc',nan],[0 -1])));
     if ~isempty(indnon)
-      line(dayd(indnon), meanc(indnon), ...
+      line(hPlotAxes(i), dayd(indnon), meanc(indnon), ...
         'Tag', ['TAG_LINE_CLIMATO_MEAN_' para], 'Linestyle', 'none', 'Color','k','Marker','d');
-      line(dayd(indnon),  meanc(indnon) + 3 * stdc(indnon), ...
+      line(hPlotAxes(i), dayd(indnon),  meanc(indnon) + 3 * stdc(indnon), ...
         'Tag', ['TAG_LINE_CLIMATO_STDDEV_PLUS_' para], 'Linestyle', 'none', 'Color','r','Marker','d');
-      line(dayd(indnon),  meanc(indnon) - 3 * stdc(indnon), ...
+      line(hPlotAxes(i), dayd(indnon),  meanc(indnon) - 3 * stdc(indnon), ...
         'Tag', ['TAG_LINE_CLIMATO_STDDEV_MINUS_' para], 'Linestyle', 'none', 'Color','r','Marker','d');
     end
     
-- 
GitLab