# HG changeset patch # User Rik # Date 1423926742 28800 # Node ID 52cd69e797846d02c6d35c8e9b6f2ff916baaf54 # Parent b59aabc08e63f5bfa7ac954f1cdaef37adae27f5 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. diff -r b59aabc08e63 -r 52cd69e79784 scripts/plot/draw/plotyy.m --- 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 diff -r b59aabc08e63 -r 52cd69e79784 scripts/plot/util/newplot.m --- 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: ###########################