changeset 27717:842d4221ac6c

legend.m: also inherit "clim" property from peer axes (bug #57258) * legend.m: Inherit "clim" property from the peer axes and add a listener.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 19 Nov 2019 16:21:16 +0100
parents 790038c12003
children 39ac47fdcda2
files scripts/plot/appearance/legend.m
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/legend.m	Tue Nov 19 15:52:12 2019 +0100
+++ b/scripts/plot/appearance/legend.m	Tue Nov 19 16:21:16 2019 +0100
@@ -185,6 +185,7 @@
     hl = axes ("tag", "legend", "handlevisibility", "off", ...
                "ydir", "reverse", "position", [.5 .5 .3 .3], ...
                "fontsize", 0.9 * get (opts.axes_handles(1), "fontsize"), ...
+               "clim", get (opts.axes_handles(1), "clim"), ...
                "colormap", get (opts.axes_handles(1), "colormap"), ...
                "xtick", [], "ytick", [], "box", "on");
 
@@ -232,6 +233,8 @@
                        "tightinset", ...
                        @(h) update_layout_cb (get (h, "__legend_handle__")));
     add_safe_listener (hl, opts.axes_handles(1), ...
+                       "clim", @(hax) set (hl, "clim", get (hax, "clim")));
+    add_safe_listener (hl, opts.axes_handles(1), ...
                        "colormap", ...
                        @(hax) set (hl, "colormap", get (hax, "colormap")));
     add_safe_listener (hl, opts.axes_handles(1), ...