# HG changeset patch # User Rik # Date 1712362692 25200 # Node ID fa8a486773fdd9e033eb872a2b8d1abef13f8647 # Parent 35ac89ffcf7c96cce872345bddb984368ee61658 legend.m: Fix error if root property "showhiddenhandles" is "on" (bug #65442) * legend.m: At start of function, check root property "showhiddenhandles". If set to "on", then turn it "off". Create an onCleanup action to restore the setting at the end of the function. diff -r 35ac89ffcf7c -r fa8a486773fd scripts/plot/appearance/legend.m --- a/scripts/plot/appearance/legend.m Fri Apr 05 19:56:56 2024 +0200 +++ b/scripts/plot/appearance/legend.m Fri Apr 05 17:18:12 2024 -0700 @@ -207,6 +207,12 @@ ## lock once that bug is properly fixed. mlock (); + ## legend() requires root property to be invisible. + if (strcmp (get (groot, 'showhiddenhandles'), 'on')) + cleanup = onCleanup (@() set (groot, 'showhiddenhandles', 'on')); + set (groot, 'showhiddenhandles', 'off'); + endif + opts = parse_opts (varargin{:}); hl = opts.legend_handle;