Mercurial > octave-nkf
changeset 19746:52cd69e79784
Fix legend function interaction with plotyy (bug #44246).
* plotyy.m: Use addproperty correctly to add property, then set value.
* newplot.m: Add special exception case when doing "replace" on an existing
axis which is a plotyy axis. Instead of re-using existing axis and doing
a "reset", delete the axis entirely and create a new one.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 14 Feb 2015 07:12:22 -0800 |
parents | b59aabc08e63 |
children | 1a6fa5a523e4 |
files | scripts/plot/draw/plotyy.m scripts/plot/util/newplot.m |
diffstat | 2 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/draw/plotyy.m Fri Feb 13 20:51:59 2015 -0800 +++ b/scripts/plot/draw/plotyy.m Sat Feb 14 07:12:22 2015 -0800 @@ -176,14 +176,16 @@ ## Store the axes handles for the sister axes. if (ishandle (ax(1)) && ! isprop (ax(1), "__plotyy_axes__")) - addproperty ("__plotyy_axes__", ax(1), "data", ax); + addproperty ("__plotyy_axes__", ax(1), "data"); + set (ax(1), "__plotyy_axes__", ax); elseif (ishandle (ax(1))) set (ax(1), "__plotyy_axes__", ax); else error ("plotyy.m: This shouldn't happen. File a bug report."); endif if (ishandle (ax(2)) && ! isprop (ax(2), "__plotyy_axes__")) - addproperty ("__plotyy_axes__", ax(2), "data", ax); + addproperty ("__plotyy_axes__", ax(2), "data"); + set (ax(2), "__plotyy_axes__", ax); elseif (ishandle (ax(2))) set (ax(2), "__plotyy_axes__", ax); else
--- a/scripts/plot/util/newplot.m Fri Feb 13 20:51:59 2015 -0800 +++ b/scripts/plot/util/newplot.m Sat Feb 14 07:12:22 2015 -0800 @@ -189,8 +189,15 @@ kids(kids == hkid) = []; delete (kids); else - __go_axes_init__ (ca, "replace"); - __request_drawnow__ (); + if (isprop (ca, "__plotyy_axes__")) + ## Hack for bug #44246. There is no way to reset or remove a + ## property created with addproperty short of deleting the object. + delete (ca); + ca = axes (); + else + __go_axes_init__ (ca, "replace"); + __request_drawnow__ (); + endif endif ## FIXME: The code above should perform the following: ###########################