[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch proposal for axes.m
From: |
Michael Goffioul |
Subject: |
Patch proposal for axes.m |
Date: |
Wed, 29 Aug 2007 16:19:29 +0200 |
The following changes allow to specify a parent when creating axes object,
which might not necessarily be a figure object (uipanel and uibuttongroup
objects can also contain axes objects). This relies on the ancestor.m
function, which is currently part of JHandles.
Michael.
2007-08-29 Michael goffioul <address@hidden>
* plot/axes.m: allow to specify a parent when creating axes objects;
also support non-figure parents
* plot/ancestor.m: new function
Index: ../../../octave-cvs/scripts/plot/axes.m
===================================================================
RCS file: /cvs/octave/scripts/plot/axes.m,v
retrieving revision 1.4
diff -c -p -r1.4 axes.m
*** ../../../octave-cvs/scripts/plot/axes.m 4 Jun 2007 06:25:21
-0000 1.4
--- ../../../octave-cvs/scripts/plot/axes.m 29 Aug 2007 14:15:21 -0000
*************** function h = axes (varargin)
*** 31,45 ****
if (nargin == 0 || nargin > 1)
## make default axes object, and make it the current axes for the
## current figure.
! cf = gcf ();
tmp = __go_axes__ (cf, varargin{:});
! set (cf, "currentaxes", tmp);
else
## arg is axes handle, make it the current axes for the current
## figure.
tmp = varargin{1};
if (ishandle (tmp) && strcmp (get (tmp, "type"), "axes"))
! parent = get (tmp, "parent");
set (0, "currentfigure", parent);
set (parent, "currentaxes", tmp);
else
--- 31,51 ----
if (nargin == 0 || nargin > 1)
## make default axes object, and make it the current axes for the
## current figure.
! idx = find (strcmpi (varargin(1:2:end), "parent"), 1, "first");
! if (! isempty (idx) && length (varargin) >= 2*idx)
! cf = varargin{2*idx};
! varargin([2*idx-1, 2*idx]) = [];
! else
! cf = gcf ();
! endif
tmp = __go_axes__ (cf, varargin{:});
! set (ancestor (cf, "figure"), "currentaxes", tmp);
else
## arg is axes handle, make it the current axes for the current
## figure.
tmp = varargin{1};
if (ishandle (tmp) && strcmp (get (tmp, "type"), "axes"))
! parent = ancestor (tmp, "figure");
set (0, "currentfigure", parent);
set (parent, "currentaxes", tmp);
else
ancestor.m
Description: Text document
- Patch proposal for axes.m,
Michael Goffioul <=