Mercurial > hg > octave-nkf
annotate scripts/plot/polar.m @ 11523:fd0a3ac60b0e
update copyright notices
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 14 Jan 2011 05:47:45 -0500 |
parents | 390d93e20531 |
children | c792872f8942 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 1993-2011 John W. Eaton |
2313 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
2313 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
245 | 18 |
3368 | 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}) |
390d93e20531
Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
22 ## @deftypefnx {Function File} {} polar (@var{h}, @dots{}) |
390d93e20531
Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
23 ## @deftypefnx {Function File} {@var{h} =} polar (@dots{}) |
7180 | 24 ## Make a two-dimensional plot given the polar coordinates @var{theta} and |
3368 | 25 ## @var{rho}. |
2311 | 26 ## |
27 ## The optional third argument specifies the line type. | |
6895 | 28 ## @seealso{plot} |
3368 | 29 ## @end deftypefn |
4 | 30 |
2314 | 31 ## Author: jwe |
32 | |
6302 | 33 function retval = polar (varargin) |
4 | 34 |
7321 | 35 [h, varargin, nargs] = __plt_get_axis_arg__ ("polar", varargin{:}); |
7216 | 36 |
10730
390d93e20531
Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
37 if (nargs < 1) |
390d93e20531
Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
38 print_usage(); |
390d93e20531
Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
39 endif |
390d93e20531
Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
40 |
7207 | 41 oldh = gca (); |
42 unwind_protect | |
43 axes (h); | |
44 newplot (); | |
3063 | 45 |
7207 | 46 if (nargs == 3) |
47 if (! ischar (varargin{3})) | |
10549 | 48 error ("polar: third argument must be a string"); |
7207 | 49 endif |
50 tmp = __plr2__ (h, varargin{:}); | |
7321 | 51 maxr = max (varargin {2} (:)); |
52 elseif (nargs == 2) | |
7207 | 53 if (ischar (varargin{2})) |
10549 | 54 tmp = __plr1__ (h, varargin{:}); |
55 if (iscomplex(varargin{1})) | |
56 maxr = max (imag(varargin{1})(:)); | |
57 else | |
58 maxr = max (varargin{1}(:)); | |
59 endif | |
7207 | 60 else |
10549 | 61 fmt = ""; |
62 tmp = __plr2__ (h, varargin{:}, fmt); | |
63 maxr = max (varargin {2} (:)); | |
7207 | 64 endif |
7321 | 65 elseif (nargs == 1) |
7207 | 66 fmt = ""; |
67 tmp = __plr1__ (h, varargin{:}, fmt); | |
7321 | 68 if (iscomplex(varargin{1})) |
10549 | 69 maxr = max (imag(varargin{1})(:)); |
7321 | 70 else |
10549 | 71 maxr = max (varargin{1}(:)); |
7321 | 72 endif |
7207 | 73 else |
74 print_usage (); | |
934 | 75 endif |
7207 | 76 |
7321 | 77 set (h, "xlim", [-maxr, maxr], "ylim", [-maxr, maxr], |
10549 | 78 "xaxislocation", "zero", "yaxislocation", "zero", |
79 "plotboxaspectratio", [1, 1, 1]); | |
7321 | 80 |
7207 | 81 if (nargout > 0) |
82 retval = tmp; | |
934 | 83 endif |
7207 | 84 unwind_protect_cleanup |
85 axes (oldh); | |
86 end_unwind_protect | |
6302 | 87 |
4 | 88 endfunction |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
89 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
90 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
|
91 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
92 if (nargin != 3) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
93 print_usage (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
94 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
95 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
96 [nr, 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
|
97 if (nr == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
98 theta = theta'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
99 tmp = nr; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
100 nr = nc; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
101 nc = tmp; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
102 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
103 theta_i = imag (theta); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
104 if (any (theta_i)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
105 rho = theta_i; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
106 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
|
107 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
108 rho = theta; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
109 theta = (1:nr)'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
110 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
111 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
112 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
|
113 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
114 endfunction |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
115 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
116 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
|
117 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
118 if (nargin != 4) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
119 print_usage (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
120 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
121 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
122 if (any (imag (theta))) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
123 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
|
124 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
125 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
126 if (any (imag (rho))) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
127 rho = real (rho); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
128 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
129 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
130 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
|
131 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
|
132 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
|
133 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
|
134 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
|
135 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
136 error ("__plr2__: invalid data for plotting"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
137 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
138 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
|
139 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
|
140 if (length (theta) != length (rho)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
141 error ("__plr2__: vector lengths must match"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
142 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
143 if (rows (rho) == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
144 rho = rho'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
145 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
146 if (rows (theta) == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
147 theta = theta'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
148 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
149 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
|
150 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
|
151 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
|
152 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
|
153 [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
|
154 if (t_nr == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
155 theta = theta'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
156 tmp = t_nr; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
157 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
|
158 t_nc = tmp; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
159 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
160 [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
|
161 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
|
162 rho = rho'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
163 tmp = r_nr; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
164 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
|
165 r_nc = tmp; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
166 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
167 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
|
168 error ("__plr2__: vector and matrix sizes must match"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
169 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
170 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
|
171 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
|
172 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
|
173 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
174 error ("__plr2__: invalid data for plotting"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
175 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
176 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
|
177 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
|
178 [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
|
179 if (r_nr == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
180 rho = rho'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
181 tmp = r_nr; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
182 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
|
183 r_nc = tmp; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
184 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
185 [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
|
186 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
|
187 theta = theta'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
188 tmp = t_nr; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
189 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
|
190 t_nc = tmp; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
191 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
192 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
|
193 error ("__plr2__: vector and matrix sizes must match"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
194 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
195 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 if (! size_equal (rho, theta)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
201 error ("__plr2__: matrix dimensions must match"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
202 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
203 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
|
204 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
|
205 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
|
206 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
207 error ("__plr2__: invalid data for plotting"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
208 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
209 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
210 error ("__plr2__: invalid data for plotting"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
211 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
212 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
7321
diff
changeset
|
213 endfunction |