From ce28918e166c09d2c7f5e1491cb63cbbd36d9351 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <Olivier.Sauter@epfl.ch>
Date: Mon, 11 Oct 2021 16:13:45 +0200
Subject: [PATCH] avoid changing legend with shot numbers for powers

---
 matlab/gdat_plot.m | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/matlab/gdat_plot.m b/matlab/gdat_plot.m
index ada21523..08551e7c 100644
--- a/matlab/gdat_plot.m
+++ b/matlab/gdat_plot.m
@@ -124,13 +124,17 @@ if all(isfield(gdat_data,{'data','t'})) && ~isempty(gdat_data.data) && ~isempty(
     zoom on;
   end
   maxnblines = 1;
-  for i=1:numel(linehandles)
-    maxnblines = max(maxnblines,numel(linehandles{i}));
-    if numel(linehandles{i}) == 1
-      set(linehandles{i},'DisplayName',[num2str(gdat_data.shot)]);
-    else
-      for j=1:numel(linehandles{i})
-        set(linehandles{i}(j),'DisplayName',[num2str(gdat_data.shot) ',' num2str(j)]);
+  if strcmp(gdat_data.gdat_request,'powers') && length(ab)==length(gdat_data.label)
+    % keep legend from label
+  else
+    for i=1:numel(linehandles)
+      maxnblines = max(maxnblines,numel(linehandles{i}));
+      if numel(linehandles{i}) == 1
+        set(linehandles{i},'DisplayName',[num2str(gdat_data.shot)]);
+      else
+        for j=1:numel(linehandles{i})
+          set(linehandles{i}(j),'DisplayName',[num2str(gdat_data.shot) ',' num2str(j)]);
+        end
       end
     end
   end
-- 
GitLab