changeset 27751:8ac3222bf951

legend.m: reset both plotyy axes data when legend is deleted (bug #57319) * legend.m (delete_legend_cb): Reset both plotyy axes data.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Thu, 28 Nov 2019 09:24:42 +0100
parents 597e50809a9c
children e0cdaad8017d
files scripts/plot/appearance/legend.m
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/legend.m	Wed Nov 27 08:16:33 2019 -0800
+++ b/scripts/plot/appearance/legend.m	Thu Nov 28 09:24:42 2019 +0100
@@ -406,12 +406,13 @@
 
   reset_cb ([], [], hl, false);
 
-  hax = getappdata (hl, "__axes_handle__")(1);
-  units = get (hax, "units");
-  set (hax, "units", getappdata (hl, "__original_units__"),
-            "looseinset", getappdata (hl, "__original_looseinset__"),
-            "units", units,
-            "__legend_handle__", []);
+  hax = getappdata (hl, "__axes_handle__");
+  for h = hax(:)'
+    units = get (h, "units");
+    set (h, "units", getappdata (hl, "__original_units__"), ...
+            "looseinset", getappdata (hl, "__original_looseinset__"), ...
+            "units", units, "__legend_handle__", []);
+  endfor
 
 endfunction