annotate scripts/plot/draw/polar.m @ 19631:db92e7e28e1f

strip trailing whitespace from most source files * NEWS, doc/interpreter/contributors.in, doc/interpreter/func.txi, doc/interpreter/genpropdoc.m, doc/interpreter/octave_logo.eps, doc/interpreter/plot.txi, doc/interpreter/stmt.txi, examples/data/Makefile.am, libinterp/corefcn/data.cc, libinterp/corefcn/debug.cc, libinterp/corefcn/error.cc, libinterp/corefcn/file-io.cc, libinterp/corefcn/gl-render.cc, libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h, libinterp/corefcn/load-path.cc, libinterp/corefcn/pr-output.cc, libinterp/corefcn/pt-jit.cc, libinterp/corefcn/strfind.cc, libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h, libinterp/corefcn/urlwrite.cc, libinterp/corefcn/variables.cc, libinterp/octave-value/ov-classdef.cc, libinterp/octave-value/ov-classdef.h, libinterp/octave.cc, libinterp/parse-tree/lex.h, libinterp/parse-tree/oct-parse.in.yy, libinterp/parse-tree/pt-classdef.h, liboctave/system/file-ops.cc, liboctave/system/oct-env.cc, m4/acinclude.m4, scripts/deprecated/finite.m, scripts/deprecated/fmod.m, scripts/deprecated/fnmatch.m, scripts/deprecated/luinc.m, scripts/deprecated/octave_tmp_file_name.m, scripts/deprecated/syl.m, scripts/deprecated/usage.m, scripts/general/inputParser.m, scripts/general/interp1.m, scripts/general/interp2.m, scripts/general/interp3.m, scripts/general/isequal.m, scripts/general/private/__isequal__.m, scripts/geometry/voronoi.m, scripts/image/image.m, scripts/image/imshow.m, scripts/image/ind2rgb.m, scripts/linear-algebra/bandwidth.m, scripts/linear-algebra/isbanded.m, scripts/miscellaneous/bzip2.m, scripts/miscellaneous/cast.m, scripts/miscellaneous/copyfile.m, scripts/miscellaneous/delete.m, scripts/miscellaneous/fullfile.m, scripts/miscellaneous/getappdata.m, scripts/miscellaneous/gunzip.m, scripts/miscellaneous/isappdata.m, scripts/miscellaneous/ls.m, scripts/miscellaneous/mex.m, scripts/miscellaneous/movefile.m, scripts/miscellaneous/orderfields.m, scripts/miscellaneous/recycle.m, scripts/miscellaneous/rmappdata.m, scripts/miscellaneous/setfield.m, scripts/miscellaneous/symvar.m, scripts/miscellaneous/tar.m, scripts/miscellaneous/tmpnam.m, scripts/miscellaneous/unpack.m, scripts/miscellaneous/ver.m, scripts/miscellaneous/what.m, scripts/miscellaneous/xor.m, scripts/miscellaneous/zip.m, scripts/optimization/fminbnd.m, scripts/optimization/sqp.m, scripts/path/private/getsavepath.m, scripts/path/savepath.m, scripts/pkg/pkg.m, scripts/pkg/private/installed_packages.m, scripts/plot/draw/plotyy.m, scripts/plot/draw/polar.m, scripts/plot/draw/private/__quiver__.m, scripts/plot/draw/private/__scatter__.m, scripts/plot/draw/private/__stem__.m, scripts/plot/draw/surface.m, scripts/plot/draw/surfnorm.m, scripts/plot/util/copyobj.m, scripts/plot/util/hgload.m, scripts/plot/util/hgsave.m, scripts/plot/util/isprop.m, scripts/plot/util/linkprop.m, scripts/plot/util/private/__go_draw_axes__.m, scripts/set/setdiff.m, scripts/set/union.m, scripts/signal/periodogram.m, scripts/sparse/eigs.m, scripts/sparse/ilu.m, scripts/sparse/qmr.m, scripts/sparse/sprand.m, scripts/sparse/sprandn.m, scripts/specfun/beta.m, scripts/specfun/ellipke.m, scripts/specfun/isprime.m, scripts/statistics/base/lscov.m, scripts/testfun/__run_test_suite__.m, scripts/testfun/test.m: Strip trailing whitespace.
author John W. Eaton <jwe@octave.org>
date Tue, 20 Jan 2015 10:29:54 -0500
parents cff49c82f722
children 4197fc428c7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17572
diff changeset
1 ## Copyright (C) 1993-2013 John W. Eaton
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
2 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
3 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
4 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
8 ## your option) any later version.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
9 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
13 ## General Public License for more details.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
14 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
17 ## <http://www.gnu.org/licenses/>.
245
16a24e76d6e0 [project @ 1993-12-03 02:00:15 by jwe]
jwe
parents: 4
diff changeset
18
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3063
diff changeset
19 ## -*- texinfo -*-
10730
390d93e20531 Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
20 ## @deftypefn {Function File} {} polar (@var{theta}, @var{rho})
390d93e20531 Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
21 ## @deftypefnx {Function File} {} polar (@var{theta}, @var{rho}, @var{fmt})
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
22 ## @deftypefnx {Function File} {} polar (@var{cplx})
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
23 ## @deftypefnx {Function File} {} polar (@var{cplx}, @var{fmt})
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
24 ## @deftypefnx {Function File} {} polar (@var{hax}, @dots{})
10730
390d93e20531 Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
25 ## @deftypefnx {Function File} {@var{h} =} polar (@dots{})
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
26 ## Create a 2-D plot from polar coordinates @var{theta} and @var{rho}.
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
27 ##
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
28 ## If a single complex input @var{cplx} is given then the real part is used
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
29 ## for @var{theta} and the imaginary part is used for @var{rho}.
2311
2b5788792cad [project @ 1996-07-11 20:18:38 by jwe]
jwe
parents: 2303
diff changeset
30 ##
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
31 ## The optional argument @var{fmt} specifies the line format in the same way
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
32 ## as @code{plot}.
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
33 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17072
diff changeset
34 ## If the first argument @var{hax} is an axes handle, then plot into this axis,
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17072
diff changeset
35 ## rather than the current axes returned by @code{gca}.
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 12789
diff changeset
36 ##
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 12789
diff changeset
37 ## The optional return value @var{h} is a graphics handle to the created plot.
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 12789
diff changeset
38 ##
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
39 ## Implementation Note: The polar axis is drawn using line and text objects
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
40 ## encapsulated in an hggroup. The hggroup properties are linked to the
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
41 ## original axes object such that altering an appearance property, for example
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
42 ## @code{fontname}, will update the polar axis. Two new properties are
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
43 ## added to the original axes--@code{rtick}, @code{ttick}--which replace
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
44 ## @code{xtick}, @code{ytick}. The first is a list of tick locations in the
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
45 ## radial (rho) direction; The second is a list of tick locations in the
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
46 ## angular (theta) direction specified in degrees, i.e., in the range 0--359.
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
47 ## @seealso{rose, compass, plot}
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3063
diff changeset
48 ## @end deftypefn
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
49
2314
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
50 ## Author: jwe
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
51
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
52 function h = polar (varargin)
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
53
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
54 [hax, varargin, nargs] = __plt_get_axis_arg__ ("polar", varargin{:});
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
55
10730
390d93e20531 Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
56 if (nargs < 1)
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
57 print_usage ();
10730
390d93e20531 Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
58 endif
390d93e20531 Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
59
17211
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17190
diff changeset
60 oldfig = [];
17301
68bcac3c043a Correct inversion accidentally introduced in cset 87ba70043bfc.
Rik <rik@octave.org>
parents: 17211
diff changeset
61 if (! isempty (hax))
17211
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17190
diff changeset
62 oldfig = get (0, "currentfigure");
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17190
diff changeset
63 endif
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7180
diff changeset
64 unwind_protect
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
65 hax = newplot (hax);
3063
4287b8c06fbf [project @ 1997-06-26 02:36:05 by jwe]
jwe
parents: 2847
diff changeset
66
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7180
diff changeset
67 if (nargs == 3)
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7180
diff changeset
68 if (! ischar (varargin{3}))
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
69 error ("polar: FMT argument must be a string");
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7180
diff changeset
70 endif
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
71 htmp = __plr2__ (hax, varargin{:});
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
72 maxr = max (varargin{2}(:));
7321
359f464342b3 [project @ 2007-12-18 03:48:03 by jwe]
jwe
parents: 7216
diff changeset
73 elseif (nargs == 2)
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7180
diff changeset
74 if (ischar (varargin{2}))
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
75 htmp = __plr1__ (hax, varargin{:});
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
76 if (iscomplex (varargin{1}))
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
77 maxr = max (imag (varargin{1})(:));
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10226
diff changeset
78 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10226
diff changeset
79 maxr = max (varargin{1}(:));
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10226
diff changeset
80 endif
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7180
diff changeset
81 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10226
diff changeset
82 fmt = "";
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
83 htmp = __plr2__ (hax, varargin{:}, fmt);
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
84 maxr = max (varargin{2}(:));
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7180
diff changeset
85 endif
7321
359f464342b3 [project @ 2007-12-18 03:48:03 by jwe]
jwe
parents: 7216
diff changeset
86 elseif (nargs == 1)
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7180
diff changeset
87 fmt = "";
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
88 htmp = __plr1__ (hax, varargin{:}, fmt);
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
89 if (iscomplex (varargin{1}))
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
90 maxr = max (imag (varargin{1})(:));
7321
359f464342b3 [project @ 2007-12-18 03:48:03 by jwe]
jwe
parents: 7216
diff changeset
91 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10226
diff changeset
92 maxr = max (varargin{1}(:));
7321
359f464342b3 [project @ 2007-12-18 03:48:03 by jwe]
jwe
parents: 7216
diff changeset
93 endif
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7180
diff changeset
94 else
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7180
diff changeset
95 print_usage ();
934
be867ddbe4aa [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents: 904
diff changeset
96 endif
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7180
diff changeset
97
18921
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
98 if (! ishold (hax))
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
99 hg = hggroup (hax, "tag", "polar_grid", "handlevisibility", "off");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
100
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
101 set (hax, "visible", "off", "plotboxaspectratio", [1, 1, 1],
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
102 "zlim", [-1 1]);
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
103
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
104 if (! isprop (hax, "rtick"))
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
105 addproperty ("rtick", hax, "data");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
106 endif
7321
359f464342b3 [project @ 2007-12-18 03:48:03 by jwe]
jwe
parents: 7216
diff changeset
107
18921
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
108 set (hax, "rtick", __calc_rtick__ (hax, maxr));
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
109
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
110 ## add t(heta)tick
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
111 if (! isprop (hax, "ttick"))
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
112 addproperty ("ttick", hax, "data");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
113 endif
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
114
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
115 ## theta(angular) ticks in degrees
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
116 set (hax, "ttick", 0:30:330);
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
117
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
118 __update_polar_grid__ (hax, [], hg);
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
119
18921
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
120 set (hg, "deletefcn", {@resetaxis, hax});
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
121
18921
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
122 addlistener (hax, "rtick", {@__update_polar_grid__, hg});
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
123 addlistener (hax, "ttick", {@__update_polar_grid__, hg});
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
124 addlistener (hax, "color", {@__update_patch__, hg});
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
125 addlistener (hax, "fontangle", {@__update_text__, hg, "fontangle"});
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
126 addlistener (hax, "fontname", {@__update_text__, hg, "fontname"});
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
127 addlistener (hax, "fontsize", {@__update_text__, hg, "fontsize"});
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
128 addlistener (hax, "fontunits", {@__update_text__, hg, "fontunits"});
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
129 addlistener (hax, "fontweight", {@__update_text__, hg, "fontweight"});
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
130 addlistener (hax, "interpreter", {@__update_text__, hg, "interpreter"});
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
131 addlistener (hax, "layer", {@__update_layer__, hg});
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
132 addlistener (hax, "gridlinestyle",{@__update_lines__,hg,"gridlinestyle"});
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
133 addlistener (hax, "linewidth", {@__update_lines__, hg, "linewidth"});
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
134 else
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
135 hg = findall (hax, "tag", "polar_grid");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
136 if (! isempty (hg))
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
137 oldrtick = max (get (hax, "rtick"));
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
138 if (maxr > oldrtick)
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
139 set (hax, "rtick", __calc_rtick__ (hax, maxr));
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
140 endif
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
141 endif
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
142 endif
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
143
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
144 unwind_protect_cleanup
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
145 if (! isempty (oldfig))
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
146 set (0, "currentfigure", oldfig);
934
be867ddbe4aa [project @ 1994-11-17 04:23:41 by jwe]
jwe
parents: 904
diff changeset
147 endif
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7180
diff changeset
148 end_unwind_protect
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6257
diff changeset
149
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
150 if (nargout > 0)
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
151 h = htmp;
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
152 endif
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
153
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
154 endfunction
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
155
18921
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
156 function rtick = __calc_rtick__ (hax, maxr)
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
157 ## FIXME: workaround: calculate r(ho)tick from xtick
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
158 savexlim = get (hax, "xlim");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
159 saveylim = get (hax, "ylim");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
160 set (hax, "xlim", [-maxr maxr], "ylim", [-maxr maxr]);
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
161 xtick = get (hax, "xtick");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
162 rtick = xtick(find (xtick > 0, 1):find (xtick >= maxr, 1));
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
163 if (isempty (rtick))
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
164 rtick = [0.5 1];
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
165 endif
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
166 set (hax, "xlim", savexlim, "ylim", saveylim);
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
167 endfunction
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
168
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
169 function retval = __plr1__ (h, theta, fmt)
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
170
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
171 theta = theta(:);
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
172 if (iscomplex (theta))
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
173 rho = imag (theta);
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
174 theta = real (theta);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
175 else
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
176 rho = theta;
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
177 theta = (1:rows (rho))';
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
178 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
179
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
180 retval = __plr2__ (h, theta, rho, fmt);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
181
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
182 endfunction
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
183
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
184 function retval = __plr2__ (h, theta, rho, fmt)
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
185
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
186 if (ndims (theta) > 2 || ndims (rho) > 2)
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
187 error ("polar: THETA and RHO must be 2-D objects");
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
188 endif
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
189 theta = real (theta);
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
190 rho = real (rho);
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
191
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
192 if (isscalar (theta))
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
193 if (isscalar (rho))
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
194 x = rho * cos (theta);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
195 y = rho * sin (theta);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
196 retval = __plt__ ("polar", h, x, y, fmt);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
197 else
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
198 error ("polar: Can't plot constant THETA with varying RHO");
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
199 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
200 elseif (isvector (theta))
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
201 if (isvector (rho))
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
202 if (length (theta) != length (rho))
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
203 error ("polar: THETA and RHO vector lengths must match");
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
204 endif
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
205 rho = rho(:);
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
206 theta = theta(:);
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
207 x = rho .* cos (theta);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
208 y = rho .* sin (theta);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
209 retval = __plt__ ("polar", h, x, y, fmt);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
210 elseif (ismatrix (rho))
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
211 theta = theta(:);
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
212 t_nr = rows (theta);
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
213 [r_nr, r_nc] = size (rho);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
214 if (t_nr != r_nr)
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
215 rho = rho';
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
216 r_nr = r_nc;
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
217 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
218 if (t_nr != r_nr)
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
219 error ("polar: THETA vector and RHO matrix sizes must match");
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
220 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
221 x = diag (cos (theta)) * rho;
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
222 y = diag (sin (theta)) * rho;
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
223 retval = __plt__ ("polar", h, x, y, fmt);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
224 else
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
225 error ("polar: invalid data for plotting");
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
226 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
227 elseif (ismatrix (theta))
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
228 if (isvector (rho))
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
229 rho = rho(:);
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
230 r_nr = rows (rho);
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
231 [t_nr, t_nc] = size (theta);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
232 if (r_nr != t_nr)
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
233 theta = theta';
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
234 t_nr = t_nc;
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
235 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
236 if (r_nr != t_nr)
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
237 error ("polar: THETA matrix and RHO vector sizes must match");
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
238 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
239 diag_r = diag (rho);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
240 x = diag_r * cos (theta);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
241 y = diag_r * sin (theta);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
242 retval = __plt__ ("polar", h, x, y, fmt);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
243 elseif (ismatrix (rho))
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
244 if (! size_equal (rho, theta))
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
245 error ("polar: THETA and RHO matrix dimensions must match");
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
246 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
247 x = rho .* cos (theta);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
248 y = rho .* sin (theta);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
249 retval = __plt__ ("polar", h, x, y, fmt);
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
250 else
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
251 error ("polar: invalid data for plotting");
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
252 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
253 else
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
254 error ("polar: invalid data for plotting");
9896
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
255 endif
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
256
1aeb39118764 convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents: 7321
diff changeset
257 endfunction
12789
482cc053281b codesprint: Add 2 demos for polar.m
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
258
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
259 ## Callback functions for listeners
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
260
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
261 function __update_text__ (hax, ~, hg, prop)
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
262
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
263 kids = get (hg, "children");
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
264 idx = strcmp (get (kids, "type"), "text");
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
265 set (kids(idx).', prop, get (hax, prop));
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
266
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
267 endfunction
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
268
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
269 function __update_lines__ (hax, ~, hg, prop)
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
270
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
271 kids = get (hg, "children");
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
272 idx = strcmp (get (kids, "type"), "line");
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
273 lprop = prop;
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
274 if (strcmp (prop, "gridlinestyle"))
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
275 lprop = "linestyle";
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
276 endif
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
277 set (kids(idx).', lprop, get (hax, prop));
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
278
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
279 endfunction
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
280
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
281 function __update_patch__ (hax, ~, hg)
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
282
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
283 kids = get (hg, "children");
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
284 idx = strcmp (get (kids, "type"), "patch");
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
285 set (kids(idx).', "facecolor", get (hax, "color"));
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
286
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
287 endfunction
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
288
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
289 function __update_layer__ (hax, ~, hg)
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
290
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
291 set (hg, "handlevisibility", "on");
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
292 kids = get (hax, "children");
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
293 if (strcmp (get (hax, "layer"), "bottom"))
19631
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 18921
diff changeset
294 set (hax, "children", [kids(kids != hg); hg]);
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
295 else
19631
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 18921
diff changeset
296 set (hax, "children", [hg; kids(kids != hg)]);
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
297 endif
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
298 set (hg, "handlevisibility", "off");
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
299
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
300 endfunction
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
301
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
302 function __update_polar_grid__ (hax, ~, hg)
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
303
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
304 ## Delete existing polar grid
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
305 delete (get (hg, "children"));
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
306
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
307 rtick = unique (get (hax, "rtick")(:)');
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
308 rtick = rtick(rtick > 0);
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
309 if (isempty (rtick))
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
310 rtick = [0.5 1];
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
311 endif
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
312
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
313 ttick = unique (get (hax, "ttick")(:)');
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
314 ttick = ttick(ttick >= 0);
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
315 if (isempty (ttick))
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
316 ttick = 0:30:330;
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
317 endif
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
318
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
319 lprops = {"linestyle", get(hax, "gridlinestyle"), ...
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
320 "linewidth", get(hax, "linewidth")};
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
321 ## "fontunits" should be first because it affects "fontsize" property.
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
322 tprops(1:2:12) = {"fontunits", "fontangle", "fontname", "fontsize", ...
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
323 "fontweight", "interpreter"};
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
324 tprops(2:2:12) = get (hax, tprops(1:2:12));
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
325
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
326 ## The number of points used for a circle
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
327 circle_points = 50;
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
328 t = linspace (0, 2*pi, circle_points)';
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
329 x = kron (cos (t), rtick);
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
330 y = kron (sin (t), rtick);
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
331
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
332 ## Draw colored disk under axes at Z-depth = -1
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
333 patch (x(:,end), y(:,end), -ones (circle_points, 1),
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
334 get (hax, "color"), "parent", hg);
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
335
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
336 ## Plot dotted circles
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
337 line (x(:,1:end-1), y(:,1:end-1), lprops{:}, "parent", hg);
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
338
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
339 ## Outer circle is drawn solid
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
340 line (x(:,end), y(:,end), lprops{:}, "linestyle", "-", "parent", hg);
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
341
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
342 ## Add radial labels
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
343 [x, y] = pol2cart (0.42 * pi, rtick);
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
344 text (x, y, num2cell (rtick), "verticalalignment", "bottom", tprops{:},
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
345 "parent", hg);
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
346
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
347 ## add radial lines
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
348 s = rtick(end) * sin (ttick * pi / 180);
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
349 c = rtick(end) * cos (ttick * pi / 180);
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
350 x = [zeros(1, numel (ttick)); c];
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
351 y = [zeros(1, numel (ttick)); s];
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
352 line (x, y, "linestyle", ":", lprops{:}, "parent", hg);
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
353
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
354 ## add angular labels
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
355 tticklabel = num2cell (ttick);
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
356 ## FIXME: This tm factor does not work as fontsize increases
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
357 tm = 1.08;
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
358 text (tm * c, tm * s, tticklabel, "horizontalalignment", "center",
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
359 tprops{:}, "parent", hg);
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
360
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
361 lim = 1.1 * rtick(end);
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
362 set (hax, "xlim", [-lim, lim], "ylim", [-lim, lim]);
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
363
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
364 ## Put polar grid behind or ahead of plot
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
365 __update_layer__ (hax, [], hg);
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
366
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
367 endfunction
12789
482cc053281b codesprint: Add 2 demos for polar.m
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
368
18921
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
369 function resetaxis (~, ~, hax)
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
370 if (isaxes (hax))
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
371 dellistener (hax, "rtick");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
372 dellistener (hax, "ttick");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
373 dellistener (hax, "color");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
374 dellistener (hax, "fontangle");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
375 dellistener (hax, "fontname");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
376 dellistener (hax, "fontsize");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
377 dellistener (hax, "fontunits");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
378 dellistener (hax, "fontweight");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
379 dellistener (hax, "interpreter");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
380 dellistener (hax, "layer");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
381 dellistener (hax, "gridlinestyle");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
382 dellistener (hax, "linewidth");
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
383 endif
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
384 endfunction
cff49c82f722 polar.m: Fix scaling of polar plot (bug #39495).
Stefan Mahr <dac922@gmx.de>
parents: 18910
diff changeset
385
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
386
12789
482cc053281b codesprint: Add 2 demos for polar.m
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
387 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
388 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
389 %! theta = linspace (0,2*pi,1000);
12789
482cc053281b codesprint: Add 2 demos for polar.m
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
390 %! rho = sin (7*theta);
482cc053281b codesprint: Add 2 demos for polar.m
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
391 %! polar (theta, rho);
17190
df4c4b7708a4 Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents: 17122
diff changeset
392 %! title ('polar() plot');
12789
482cc053281b codesprint: Add 2 demos for polar.m
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
393
482cc053281b codesprint: Add 2 demos for polar.m
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
394 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
395 %! clf;
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
396 %! theta = linspace (0,2*pi,1000);
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
397 %! cplx = theta + i*sin (7*theta);
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
398 %! polar (cplx, 'g');
17190
df4c4b7708a4 Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents: 17122
diff changeset
399 %! title ('polar() plot of complex data');
17072
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
400
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
401 %!demo
22fa8c77b92d polar.m, rose.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
402 %! clf;
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
403 %! theta = linspace (0,2*pi,1000);
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
404 %! rho = sin (2*theta).*cos (2*theta);
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
405 %! polar (theta, rho, '--r');
18910
cafffc1b70b1 update plot demo blocks for compare_plot_demos
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18780
diff changeset
406 %! set (gca, 'rtick', 0.1:0.1:0.6, 'ttick', 0:20:340);
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
407 %! title ('polar() plot with finer grid');
12789
482cc053281b codesprint: Add 2 demos for polar.m
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
408
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
409 %!demo
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
410 %! clf;
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
411 %! theta = linspace (0,2*pi,1000);
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
412 %! rho = sin (2*theta).*cos (2*theta);
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
413 %! polar (theta, rho, '--b');
18910
cafffc1b70b1 update plot demo blocks for compare_plot_demos
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18780
diff changeset
414 %! set (gca, 'fontsize', 12, 'linewidth', 2, 'color', [0.8 0.8 0.8]);
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
415 %! title ('polar() plot with modified axis appearance');
18779
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
416
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
417 %!demo
b5b73959907f polar.m: add circular theta/rho axes (bug 39495).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
418 %! clf;
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
419 %! theta = linspace (0,8*pi,1000);
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
420 %! rho = sin (5/4*theta);
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
421 %! polar (theta, rho);
18910
cafffc1b70b1 update plot demo blocks for compare_plot_demos
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18780
diff changeset
422 %! set (gca, 'rtick', 0.2:0.2:1);
18780
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
423 %! title ('polar() plot');
56bff71de2ca polar.m: Link polar grid with axes properties (bug #39495).
Rik <rik@octave.org>
parents: 18779
diff changeset
424