changeset 20413:56301a6c337a stable

polar.m: Display plot titles on polar plots (bug #45514). * polar.m (__update_layer__): When re-ordering children to account for layer attribute, turn on root property "showhiddenhandles" so that hidden axis children like the title object are included in the sorting.
author Rik <rik@octave.org>
date Thu, 23 Jul 2015 09:45:59 -0700
parents 8c4317b8f7c5
children 421e3ebfca8d 85dcbed19753
files scripts/plot/draw/polar.m
diffstat 1 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/draw/polar.m	Fri Jul 10 11:55:14 2015 -0700
+++ b/scripts/plot/draw/polar.m	Thu Jul 23 09:45:59 2015 -0700
@@ -266,7 +266,7 @@
 
 endfunction
 
-function __update_lines__ (hax,  ~, hg, prop)
+function __update_lines__ (hax, ~, hg, prop)
 
   kids = get (hg, "children");
   idx = strcmp (get (kids, "type"), "line");
@@ -286,17 +286,22 @@
 
 endfunction
 
-function __update_layer__ (hax,  ~, hg)
+function __update_layer__ (hax, ~, hg)
 
-  set (hg, "handlevisibility", "on");
-  kids = get (hax, "children");
-  if (strcmp (get (hax, "layer"), "bottom"))
-    set (hax, "children", [kids(kids != hg); hg]);
-  else
-    set (hax, "children", [hg; kids(kids != hg)]);
-  endif
-  set (hg, "handlevisibility", "off");
-
+  ## FIXME: This re-implements allchild() because setting the "children"
+  ##        property needs to preserve all children (titles, xlabels, etc.).
+  shh = get (0, "showhiddenhandles");
+  unwind_protect
+    set (0, "showhiddenhandles", "on");
+    kids = get (hax, "children");
+    if (strcmp (get (hax, "layer"), "bottom"))
+      set (hax, "children", [kids(kids != hg); hg]);
+    else
+      set (hax, "children", [hg; kids(kids != hg)]);
+    endif
+  unwind_protect_cleanup
+    set (0, "showhiddenhandles", shh);
+  end_unwind_protect
 endfunction
 
 function __update_polar_grid__ (hax, ~, hg)