changeset 30552:752b71dc41f8

maint: merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 25 Dec 2021 16:11:17 +0100
parents c24457a42219 (current diff) 4d2b528464ad (diff)
children 2dc31151ca27
files
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/newplot.m	Sat Dec 25 13:58:05 2021 +0100
+++ b/scripts/plot/util/newplot.m	Sat Dec 25 16:11:17 2021 +0100
@@ -199,8 +199,10 @@
             && ! any (strcmp({dbstack().name}, "plotyy")))
           ## Hack for bug #44246.  There is no way to reset or remove a
           ## property created with addproperty short of deleting the object.
+          old_units = get (ca, "units");
+          old_position = get (ca, "position");
           delete (ca);
-          ca = axes ();
+          ca = axes ("units", old_units, "position", old_position);
         elseif (do_reset)
           rcn = getappdata (ca, "__subplotrcn__");
           delete (allchild (ca));
@@ -266,3 +268,15 @@
 %! unwind_protect_cleanup
 %!   close (hf);
 %! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   hax = axes ("units", "normalized", "position", [0.1, 0.1, 0.8, 0.3]);
+%!   plotyy (hax, 1:4, 1:4, 1:4, 4:-1:1);
+%!   hax2 = newplot ();
+%!   assert (get (hax2, "units"), "normalized");
+%!   assert (get (hax2, "position"), [0.1, 0.1, 0.8, 0.3]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect