diff --git a/matlab/gdat_plot.m b/matlab/gdat_plot.m
index 5c378833f33ab93b9c8a08694dfd09989c776b67..464fd6c8ae14e3036e5dbd0499a22fc0bdc2a2c4 100644
--- a/matlab/gdat_plot.m
+++ b/matlab/gdat_plot.m
@@ -126,8 +126,12 @@ if all(isfield(gdat_data,{'data','t'})) && ~isempty(gdat_data.data) && ~isempty(
   maxnblines = 1;
   for i=1:numel(linehandles)
     maxnblines = max(maxnblines,numel(linehandles{i}));
-    for j=1:numel(linehandles{i})
-      set(linehandles{i}(j),'DisplayName',[num2str(gdat_data.shot) ',' num2str(j)]);
+    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
   if maxnblines==1; legend show; end