changeset 27716:790038c12003

legend.m: handle non default colormap (bug #54757) * legend.m: initialize default properties, including "colormap", when creating the legend axes.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 19 Nov 2019 15:52:12 +0100
parents 95cc1f535ba8
children 842d4221ac6c
files scripts/plot/appearance/legend.m
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/legend.m	Tue Nov 19 13:23:32 2019 +0100
+++ b/scripts/plot/appearance/legend.m	Tue Nov 19 15:52:12 2019 +0100
@@ -178,17 +178,15 @@
       pval = [pval, "box", "on"];
     endif
 
-  elseif (isempty (hl))
-
-    pval = ["fontsize", (0.9 * get (opts.axes_handles(1), "fontsize")), ...
-            "box", "on", pval];
-
   endif
 
   if (isempty (hl))
 
-    hl = axes ("tag", "legend", "handlevisibility", "off", "ydir", "reverse",
-               "position", [.5 .5 .3 .3], "xtick", [], "ytick", []);
+    hl = axes ("tag", "legend", "handlevisibility", "off", ...
+               "ydir", "reverse", "position", [.5 .5 .3 .3], ...
+               "fontsize", 0.9 * get (opts.axes_handles(1), "fontsize"), ...
+               "colormap", get (opts.axes_handles(1), "colormap"), ...
+               "xtick", [], "ytick", [], "box", "on");
 
     ## FIXME: Use the axes appdata to store its peer legend handle
     ## rather that adding a public property and change all uses.