[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with __plt_get_axis_arg__.m
From: |
David Bateman |
Subject: |
Re: Problem with __plt_get_axis_arg__.m |
Date: |
Mon, 10 Dec 2007 12:10:29 +0100 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
Michael Goffioul wrote:
> On 12/4/07, Michael Goffioul <address@hidden> wrote:
>
>> On 12/3/07, John W. Eaton <address@hidden> wrote:
>>
>>> | This looks good. Why not do the same for all functions if it is faster..
>>>
>>> Seems fine to me. I would certainly consider a patch.
>>>
>> I'll try to come with a complete patch soon.
>>
>
> While trying to extend the patch to other objects, I noticed 2 things:
> 1) __patch__.m explicitely set clim of the axes: is this really needed?
>
Humm, this was Kai that wrote this part of __patch__. My gut feeling is
that __patch__ probably doesn't need it and shouldn't have it as the
clim autoscaling should do this correctly. So its probably worth getting
rid of this stuff. However the "cdata" field of the patches appears to
be broken as the fourth demo of patch doesn't work. The issue is that
the data_property class in graphics.h.in has the data to be a Matrix,
whereas the cdata can be a 3D object, and is in the fourth demo. The
attached patch also addresses that
> 2) image.m does not support property/value pairs in its argument; I'm
> not going to work on that, so if anybody wants to do it...
>
What about the attached for that.. It doesn't address the same issue in
imagesc however.
D.
--
David Bateman address@hidden
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
*** ./scripts/image/image.m.orig5 2007-12-10 12:03:49.442962618 +0100
--- ./scripts/image/image.m 2007-12-10 12:02:33.864893697 +0100
***************
*** 41,97 ****
function retval = image (varargin)
! if (nargin == 0)
! __image__ (gca ());
! elseif (nargin == 1)
! print_usage ();
! elseif (isscalar (varargin{1}) && ishandle (varargin{1}))
! h = varargin{1};
! if (! strcmp (get (h, "type"), "axes"))
! error ("image: expecting first argument to be an axes object");
! endif
! oldh = gca ();
! unwind_protect
! axes (h);
! tmp = __image__ (h, varargin{2:end});
! unwind_protect_cleanup
! axes (oldh);
! end_unwind_protect
! else
! tmp = __image__ (gca (), varargin{:});
! endif
!
! if (nargout > 0)
! retval = tmp;
! endif
!
! endfunction
! function h = __image__ (ax, x, y, img)
!
! ## Deprecated zoom. Remove this hunk of code if old zoom argument
! ## is outmoded.
! if ((nargin == 3 && isscalar (y)) || nargin == 5)
! warning ("image: zoom argument ignored -- use GUI features");
! endif
! if (nargin == 5)
! nargin = 4;
! endif
! if (nargin == 3 && isscalar (y))
! nargin = 2;
! endif
! if (nargin == 1)
! ## Load Bobbie Jo Richardson (Born 3/16/94)
img = loadimage ("default.img");
x = y = [];
! elseif (nargin == 2)
! img = x;
x = y = [];
! elseif (nargin == 3 || nargin > 4)
print_usage ();
endif
! h = __img__ (x, y, img);
endfunction
--- 41,81 ----
function retval = image (varargin)
! [ax, varargin, nargin] = __plt_get_axis_arg__ ("image", varargin{:});
! firstnonnumeric = Inf;
! for i = 1 : nargin
! if (! isnumeric (varargin{i}))
! firstnonnumeric = i;
! break;
! endif
! endfor
! if (nargin == 0 || firstnonnumeric == 1)
img = loadimage ("default.img");
x = y = [];
! elseif (nargin == 1 || firstnonnumeric == 2)
! img = varargin{1};
x = y = [];
! elseif (nargin == 2 || firstnonnumeric == 3)
print_usage ();
+ else
+ x = varargin{1};
+ y = varargin{2};
+ img = varargin{3};
+ firstnonnumeric = 4;
endif
! oldax = gca ();
! unwind_protect
! axes (ax);
! h = __img__ (x, y, img, varargin {firstnonnumeric:end});
! unwind_protect_cleanup
! axes (oldax);
! end_unwind_protect
!
! if (nargout > 0)
! retval = h;
! endif
endfunction
*** ./scripts/plot/__patch__.m.orig5 2007-12-10 10:15:58.690594009 +0100
--- ./scripts/plot/__patch__.m 2007-12-10 10:22:44.086063358 +0100
***************
*** 141,149 ****
error ("patch: not supported");
endif
- h = __go_patch__ (p);
- ax = get (h, "parent");
-
cargs = {};
if (have_c)
if (ischar (c))
--- 141,146 ----
***************
*** 160,173 ****
cargs{2} = "flat";
cargs{3} = "cdata";
cargs{4} = c;
- clim = get (ax, "clim");
- if (c(1) < clim(1))
- set (ax, "clim", [c(1), clim(2)])
- clim(1) = c(1);
- endif
- if (c(1) > clim(2))
- set (ax, "clim", [clim(1), c(1)])
- endif
else
error ("patch: color value not valid");
endif
--- 157,162 ----
***************
*** 178,194 ****
cargs{4} = c;
else
## Color Vectors
-
if (rows (c2) != rows (x) || rows (c2) != length (y))
error ("patch: size of x, y, and c must be equal")
else
cargs{1} = "facecolor";
cargs{2} = "interp";
- if (abs(max(c2(:)) - min(c2(:))) < eps)
- set (ax, "clim", [c2(1)-1, c2(1)+1])
- else
- set (ax, "clim", [min(c2(:)), max(c2(:))]);
- endif
endif
endif
else
--- 167,177 ----
***************
*** 196,203 ****
cargs{2} = [0, 1, 0];
endif
! set (h, "xdata", x, "ydata", y, "faces", faces, "vertices", vert,
! cargs{:}, varargin{iarg:end});
if (have_z)
set (h, "zdata", z);
endif
--- 179,186 ----
cargs{2} = [0, 1, 0];
endif
! h = __go_patch__ (p, "xdata", x, "ydata", y, "faces", faces,
! "vertices", vert, cargs{:}, varargin{iarg:end});
if (have_z)
set (h, "zdata", z);
endif
*** ./src/graphics.h.in.orig5 2007-12-10 11:40:07.109302118 +0100
--- ./src/graphics.h.in 2007-12-10 11:27:42.484190552 +0100
***************
*** 408,414 ****
class data_property
{
public:
! data_property (const Matrix& m = Matrix ())
: data (m), xmin (octave_Inf), xmax (-octave_Inf), xminp (octave_Inf)
{
get_data_limits ();
--- 408,420 ----
class data_property
{
public:
! data_property (const NDArray& m = NDArray ())
! : data (m), xmin (octave_Inf), xmax (-octave_Inf), xminp (octave_Inf)
! {
! get_data_limits ();
! }
!
! data_property (const Matrix& m)
: data (m), xmin (octave_Inf), xmax (-octave_Inf), xminp (octave_Inf)
{
get_data_limits ();
***************
*** 417,423 ****
data_property (const octave_value& val)
: data (), xmin (octave_Inf), xmax (-octave_Inf), xminp (octave_Inf)
{
! data = val.matrix_value ();
get_data_limits ();
}
--- 423,429 ----
data_property (const octave_value& val)
: data (), xmin (octave_Inf), xmax (-octave_Inf), xminp (octave_Inf)
{
! data = val.array_value ();
get_data_limits ();
}
***************
*** 442,448 ****
double min_pos (void) const { return xminp; }
private:
! Matrix data;
double xmin;
double xmax;
double xminp;
--- 448,454 ----
double min_pos (void) const { return xminp; }
private:
! NDArray data;
double xmin;
double xmax;
double xminp;
2007-12-10 David Bateman <address@hidden>
* image/image.m: Rewritten to allow trailing properties to be
passed to underlying image object.
* plot/__patch__.m: Don't set clim, rely on autoscaling.
2007-12-10 David Bateman <address@hidden>
* graphics.h.in (class data_property): Make data private value be
of the type NDArray.
- Re: Problem with __plt_get_axis_arg__.m, (continued)
- Re: Problem with __plt_get_axis_arg__.m, Michael Goffioul, 2007/12/03
- Re: Problem with __plt_get_axis_arg__.m, David Bateman, 2007/12/03
- Re: Problem with __plt_get_axis_arg__.m, Michael Goffioul, 2007/12/03
- Re: Problem with __plt_get_axis_arg__.m, David Bateman, 2007/12/03
- Re: Problem with __plt_get_axis_arg__.m, Michael Goffioul, 2007/12/03
- Re: Problem with __plt_get_axis_arg__.m, Michael Goffioul, 2007/12/03
- Re: Problem with __plt_get_axis_arg__.m, David Bateman, 2007/12/03
- Re: Problem with __plt_get_axis_arg__.m, John W. Eaton, 2007/12/03
- Re: Problem with __plt_get_axis_arg__.m, Michael Goffioul, 2007/12/04
- Re: Problem with __plt_get_axis_arg__.m, Michael Goffioul, 2007/12/06
- Re: Problem with __plt_get_axis_arg__.m,
David Bateman <=
- Re: Problem with __plt_get_axis_arg__.m, Michael Goffioul, 2007/12/10
- Re: Problem with __plt_get_axis_arg__.m, David Bateman, 2007/12/10
- Re: Problem with __plt_get_axis_arg__.m, John W. Eaton, 2007/12/10
- Re: Problem with __plt_get_axis_arg__.m, John W. Eaton, 2007/12/03
- Re: Problem with __plt_get_axis_arg__.m, Michael Goffioul, 2007/12/03
- Re: Problem with __plt_get_axis_arg__.m, David Bateman, 2007/12/03