# HG changeset patch # User Markus Mützel # Date 1640445077 -3600 # Node ID 752b71dc41f835a083516760a132511354520780 # Parent c24457a42219d8e5b71da41af343ac50262fc35c# Parent 4d2b528464ad7ed4de315bcc4b19cf67f55a1e8a maint: merge stable to default. diff -r c24457a42219 -r 752b71dc41f8 scripts/plot/util/newplot.m --- 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