[Pkg-octave-devel] Bug#472069: octave3.0: plotyy leaves remains on future graphs
This bug is resolved by the patch I send upstream at
http://www.nabble.com/-Changeset--plotyy-leaves-traces-of-previous-plots-to16341759.html
and attached here
D.
--
David Bateman David.Bateman@motorola.com
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
# HG changeset patch
# User David Bateman <dbateman@free.fr>
# Date 1206657423 -3600
# Node ID 581a5a34f875f28e799e9c70cf64c1cb4df8775f
# Parent 19c442cd6b1e720182a9322baba77d17c90d12aa
Fix axis handle treatment in plotyy
diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@ 2008-03-27 Bill Denney <bill@denney.ws
+2008-03-27 David BAteman <dbateman@free.fr>
+
+ * plot/plotyy.m: The axis handle is a two element vector and
+ so needs special treatment. Call newplot for the second axis.
+
2008-03-27 Bill Denney <bill@denney.ws>
* time/datenum.m: Allow vector inputs in any orientation.
diff --git a/scripts/plot/plotyy.m b/scripts/plot/plotyy.m
--- a/scripts/plot/plotyy.m
+++ b/scripts/plot/plotyy.m
@@ -55,7 +55,37 @@
function [Ax, H1, H2] = plotyy (varargin)
- [ax, varargin] = __plt_get_axis_arg__ ("plotyy", varargin{:});
+ ## Don't use __plt_get_axis_arg__ here as ax is a two vector for plotyy
+ if (nargin > 1 && length (varargin{1}) == 2 && ishandle(varargin{1}(1))
+ && ishandle(varargin{1}(2)) &&
+ all (floor (varargin{1}) != varargin{1}))
+ obj1 = get (varargin{1}(1));
+ obj2 = get (varargin{1}(2));
+ if (strcmp (obj1.type, "axes") || strcmp (obj2.type, "axes"))
+ ax = [obj1, obj2];
+ varargin(1) = [];
+ if (isempty (varargin))
+ varargin = {};
+ endif
+ else
+ error ("plotyy: expecting first argument to be axes handle");
+ endif
+ else
+ f = get (0, "currentfigure");
+ if (isempty (f))
+ ax(1) = axes ();
+ ax(2) = axes ();
+ else
+ ax = get (f, "children");
+ for i = 3 : length (ax)
+ delete (ax (i));
+ endfor
+ ax = ax(1:2);
+ endif
+ if (nargin < 2)
+ varargin = {};
+ endif
+ endif
if (nargin < 4)
print_usage ();
@@ -63,8 +93,6 @@ function [Ax, H1, H2] = plotyy (varargin
oldh = gca ();
unwind_protect
- axes (ax);
- newplot ();
[ax, h1, h2] = __plotyy__ (ax, varargin{:});
unwind_protect_cleanup
axes (oldh);
@@ -92,6 +120,8 @@ function [ax, h1, h2] = __plotyy__ (ax,
xlim = [min([x1(:); x2(:)]), max([x1(:); x2(:)])];
+ axes (ax(1));
+ newplot ();
h1 = feval (fun1, x1, y1);
set (ax(1), "ycolor", getcolor (h1(1)));
@@ -101,7 +131,9 @@ function [ax, h1, h2] = __plotyy__ (ax,
cf = gcf ();
set (cf, "nextplot", "add");
- ax(2) = axes ();
+ axes (ax(2));
+ newplot ();
+
colors = get (ax(1), "colororder");
set (ax(2), "colororder", [colors(2:end,:); colors(1,:)]);
Reply to: