Mercurial > hg > octave-lojdl
changeset 7321:359f464342b3
[project @ 2007-12-18 03:48:03 by jwe]
author | jwe |
---|---|
date | Tue, 18 Dec 2007 03:48:04 +0000 |
parents | 70ddbed64bad |
children | 40a17a87155e |
files | liboctave/Array.cc liboctave/ChangeLog scripts/ChangeLog scripts/image/imshow.m scripts/plot/Makefile.in scripts/plot/__go_draw_axes__.m scripts/plot/polar.m |
diffstat | 7 files changed, 79 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -2246,7 +2246,7 @@ { dim_vector result_dims; - if (vec_equiv) + if (vec_equiv && ! orig_len == 1) { result_dims = dv;
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2007-12-17 John W. Eaton <jwe@octave.org> + + * Array.cc (Array<T>::indexN): Correctly handle scalar indexed by + N-d array. + 2007-12-17 David Bateman <dbateman@free.fr> * Sparse-op-defs.h (SPARSE_ANY_ALL_OP_ROW_CODE): Use ridx for row
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,16 @@ +2007-12-17 David Bateman <dbateman@free.fr> + + * plot/rose.m, plot/feather.m, plot/compass.m: New functions + * plot/Makefiles (SOURCES): Add them to the sources + * plot/polar.m: Set the x and y limits to the maximum polar + radius. Set the axes to be square. + * plot/__go_draw_axes__.m: Allow {x|y}axislocation to be "zero" + and print axis at zero if this is used. + + * plot/__go_draw_axes__.m: Use "set pm3d explicit" so that + contours can overlay pcolor plots. Priveldge no hidden line + removal when there are multiple objects in the plot. + 2007-12-17 Peter A. Gustafson <petegus@umich.edu> * plot/__go_draw_axes__.m: Fix mirrored tics and borders for @@ -8,12 +21,6 @@ * miscellaneous/run.m: Replace script with f when looking for file to run. -2007-12-17 David Bateman <dbateman@free.fr> - - * plot/__go_draw_axes__.m: Use "set pm3d explicit" so that - contours can overlay pcolor plots. Priveldge no hidden line - removal when there are multiple objects in the plot. - 2007-12-14 David Bateman <dbateman@free.fr> * plot/contour3.m, plot/__contour__.m: Handle linespec.
--- a/scripts/image/imshow.m +++ b/scripts/image/imshow.m @@ -150,9 +150,11 @@ ## Scale the image to the interval [0, 1] according to display_range. if (! (true_color || indexed || islogical (im))) - low = display_range(1); - high = display_range(2); - im = (im-low)/(high-low); + class (im) +im + low = display_range(1) + high = display_range(2) + im = (im-low)/(high-low) im(im < 0) = 0; im(im > 1) = 1; endif
--- a/scripts/plot/Makefile.in +++ b/scripts/plot/Makefile.in @@ -78,6 +78,7 @@ close.m \ closereq.m \ colorbar.m \ + compass.m \ contour3.m \ contour.m \ contourc.m \ @@ -86,6 +87,7 @@ drawnow.m \ ellipsoid.m \ errorbar.m \ + feather.m \ figure.m \ fill.m \ findobj.m \ @@ -124,6 +126,7 @@ quiver3.m \ replot.m \ ribbon.m \ + rose.m \ scatter.m \ scatter3.m \ semilogx.m \
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -185,6 +185,9 @@ else xaxisloc = "x"; xaxisloc_using = "x1"; + if (strcmpi (axis_obj.xaxislocation, "zero")) + fputs (plot_stream, "set xzeroaxis;\n"); + endif endif if (strcmpi (axis_obj.yaxislocation, "right")) yaxisloc = "y2"; @@ -192,6 +195,9 @@ else yaxisloc = "y"; yaxisloc_using = "y1"; + if (strcmpi (axis_obj.yaxislocation, "zero")) + fputs (plot_stream, "set yzeroaxis;\n"); + endif endif have_grid = false; @@ -1470,32 +1476,42 @@ function do_tics (obj, plot_stream, ymirror, mono) if (strcmpi (obj.xaxislocation, "top")) do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, - obj.xcolor, "x2", plot_stream, true, mono); + obj.xcolor, "x2", plot_stream, true, mono, "border"); do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, - obj.xcolor, "x", plot_stream, true, mono); + obj.xcolor, "x", plot_stream, true, mono, "border"); + elseif (strcmpi (obj.xaxislocation, "zero")) + do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, + obj.xcolor, "x", plot_stream, true, mono, "axis"); + do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, + obj.xcolor, "x2", plot_stream, true, mono, "axis"); else do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, - obj.xcolor, "x", plot_stream, true, mono); + obj.xcolor, "x", plot_stream, true, mono, "border"); do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, - obj.xcolor, "x2", plot_stream, true, mono); + obj.xcolor, "x2", plot_stream, true, mono, "border"); endif if (strcmpi (obj.yaxislocation, "right")) do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, - obj.ycolor, "y2", plot_stream, ymirror, mono); + obj.ycolor, "y2", plot_stream, ymirror, mono, "border"); do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, - obj.ycolor, "y", plot_stream, ymirror, mono); + obj.ycolor, "y", plot_stream, ymirror, mono, "border"); + elseif (strcmpi (obj.xaxislocation, "zero")) + do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, + obj.ycolor, "y", plot_stream, ymirror, mono, "axis"); + do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, + obj.ycolor, "y2", plot_stream, ymirror, mono, "axis"); else do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, - obj.ycolor, "y", plot_stream, ymirror, mono); + obj.ycolor, "y", plot_stream, ymirror, mono, "border"); do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, - obj.ycolor, "y2", plot_stream, ymirror, mono); + obj.ycolor, "y2", plot_stream, ymirror, mono, "border"); endif do_tics_1 (obj.ztickmode, obj.ztick, obj.zticklabelmode, obj.zticklabel, - obj.zcolor, "z", plot_stream, true, mono); + obj.zcolor, "z", plot_stream, true, mono, "border"); endfunction function do_tics_1 (ticmode, tics, labelmode, labels, color, ax, - plot_stream, mirror, mono) + plot_stream, mirror, mono, axispos) colorspec = get_text_colorspec (color, mono); if (strcmpi (ticmode, "manual")) if (isempty (tics)) @@ -1510,9 +1526,9 @@ nlabels = numel (labels); fprintf (plot_stream, "set format %s \"%%s\";\n", ax); if (mirror) - fprintf (plot_stream, "set %stics (", ax); + fprintf (plot_stream, "set %stics %s (", ax, axispos); else - fprintf (plot_stream, "set %stics nomirror (", ax); + fprintf (plot_stream, "set %stics %s nomirror (", ax, axispos); endif labels = regexprep(labels, "%", "%%"); for i = 1:ntics @@ -1531,9 +1547,9 @@ else fprintf (plot_stream, "set format %s \"%%g\";\n", ax); if (mirror) - fprintf (plot_stream, "set %stics (", ax); + fprintf (plot_stream, "set %stics %s (", ax, axispos ); else - fprintf (plot_stream, "set %stics nomirror (", ax); + fprintf (plot_stream, "set %stics %s nomirror (", ax, axispos); endif fprintf (plot_stream, " %g,", tics(1:end-1)); fprintf (plot_stream, " %g);\n", tics(end)); @@ -1541,9 +1557,10 @@ else fprintf (plot_stream, "set format %s \"%%g\";\n", ax); if (mirror) - fprintf (plot_stream, "set %stics %s;\n", ax, colorspec); + fprintf (plot_stream, "set %stics %s %s;\n", ax, axispos, colorspec); else - fprintf (plot_stream, "set %stics nomirror %s;\n", ax, colorspec); + fprintf (plot_stream, "set %stics %s nomirror %s;\n", ax, + axispos, colorspec); endif endif endfunction
--- a/scripts/plot/polar.m +++ b/scripts/plot/polar.m @@ -30,34 +30,48 @@ function retval = polar (varargin) - [h, varargin] = __plt_get_axis_arg__ ("polar", varargin{:}); + [h, varargin, nargs] = __plt_get_axis_arg__ ("polar", varargin{:}); oldh = gca (); unwind_protect axes (h); newplot (); - nargs = numel (varargin); - if (nargs == 3) if (! ischar (varargin{3})) error ("polar: third argument must be a string"); endif tmp = __plr2__ (h, varargin{:}); - elseif (nargin == 2) + maxr = max (varargin {2} (:)); + elseif (nargs == 2) if (ischar (varargin{2})) tmp = __plr1__ (h, varargin{:}); + if (iscomplex(varargin{1})) + maxr = max (imag(varargin{1})(:)); + else + maxr = max (varargin{1}(:)); + endif else fmt = ""; tmp = __plr2__ (h, varargin{:}, fmt); + maxr = max (varargin {2} (:)); endif - elseif (nargin == 1) + elseif (nargs == 1) fmt = ""; tmp = __plr1__ (h, varargin{:}, fmt); + if (iscomplex(varargin{1})) + maxr = max (imag(varargin{1})(:)); + else + maxr = max (varargin{1}(:)); + endif else print_usage (); endif + set (h, "xlim", [-maxr, maxr], "ylim", [-maxr, maxr], + "xaxislocation", "zero", "yaxislocation", "zero", + "dataaspectratio", [1, 1, 1]); + if (nargout > 0) retval = tmp; endif