Mercurial > octave-nkf
annotate scripts/plot/private/__plt__.m @ 11462:aed2c50c3082
legend.m: legend with more than two inline keys (bug 31991). Add/modifyy demos.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sat, 08 Jan 2011 10:08:38 -0500 |
parents | a451eb6f92b2 |
children | fd0a3ac60b0e |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002, 2004, |
8920 | 2 ## 2005, 2006, 2007, 2009 John W. Eaton |
2313 | 3 ## |
4 ## This file is part of Octave. | |
5 ## | |
6 ## Octave is free software; you can redistribute it and/or modify it | |
7 ## under the terms of the GNU General Public License as published by | |
7016 | 8 ## the Free Software Foundation; either version 3 of the License, or (at |
9 ## your option) any later version. | |
2313 | 10 ## |
11 ## Octave is distributed in the hope that it will be useful, but | |
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 ## General Public License for more details. | |
15 ## | |
16 ## You should have received a copy of the GNU General Public License | |
7016 | 17 ## along with Octave; see the file COPYING. If not, see |
18 ## <http://www.gnu.org/licenses/>. | |
245 | 19 |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
20 ## -*- texinfo -*- |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
21 ## @deftypefn {Function File} {} __plt__ (@var{caller}, @var{h}, @var{varargin}) |
6895 | 22 ## Undocumented internal function. |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
23 ## @end deftypefn |
3402 | 24 |
2314 | 25 ## Author: jwe |
26 | |
6302 | 27 function retval = __plt__ (caller, h, varargin) |
5406 | 28 |
6257 | 29 nargs = nargin - 2; |
6146 | 30 |
6257 | 31 if (nargs > 0) |
934 | 32 |
5116 | 33 k = 1; |
5119 | 34 |
35 x_set = false; | |
36 y_set = false; | |
6459 | 37 property_set = false; |
38 properties = {}; | |
934 | 39 |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
40 hlgnd = []; |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
41 tlgnd = {}; |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
42 |
5116 | 43 ## Gather arguments, decode format, gather plot strings, and plot lines. |
934 | 44 |
6405 | 45 retval = []; |
46 | |
6257 | 47 while (nargs > 0 || x_set) |
5115 | 48 |
5119 | 49 if (nargs == 0) |
10549 | 50 ## Force the last plot when input variables run out. |
51 next_cell = {}; | |
52 next_arg = {""}; | |
5118 | 53 else |
10549 | 54 next_cell = varargin(k); |
55 next_arg = varargin{k++}; | |
5116 | 56 endif |
934 | 57 |
6257 | 58 nargs--; |
59 | |
6146 | 60 if (ischar (next_arg) || iscellstr (next_arg)) |
10549 | 61 if (x_set) |
62 [options, valid] = __pltopt__ (caller, next_arg, false); | |
63 if (! valid) | |
64 if (nargs == 0) | |
65 error ("%s: properties must appear followed by a value", caller); | |
66 endif | |
67 properties = [properties, [next_cell, varargin(k++)]]; | |
68 nargs--; | |
69 continue; | |
70 else | |
71 while (nargs > 0 && ischar (varargin{k})) | |
72 if (nargs < 2) | |
73 error ("%s: properties must appear followed by a value", | |
74 caller); | |
75 endif | |
76 properties = [properties, varargin(k:k+1)]; | |
77 k += 2; | |
78 nargs -= 2; | |
79 endwhile | |
80 endif | |
81 if (y_set) | |
82 tmp = __plt2__ (h, x, y, options, properties); | |
11421
a451eb6f92b2
__plt__.m: Fix to allow inline legend keys. Bug 31991.
Ben Abbott <bpabbott@mac.com>
parents:
11000
diff
changeset
|
83 [hlgnd, tlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd); |
10549 | 84 properties = {}; |
85 retval = [retval; tmp]; | |
86 else | |
87 tmp = __plt1__ (h, x, options, properties); | |
11421
a451eb6f92b2
__plt__.m: Fix to allow inline legend keys. Bug 31991.
Ben Abbott <bpabbott@mac.com>
parents:
11000
diff
changeset
|
88 [hlgnd, tlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd); |
10549 | 89 properties = {}; |
90 retval = [retval; tmp]; | |
91 endif | |
92 x_set = false; | |
93 y_set = false; | |
94 else | |
95 error ("plot: no data to plot"); | |
96 endif | |
5116 | 97 elseif (x_set) |
10549 | 98 if (y_set) |
99 options = __pltopt__ (caller, {""}); | |
100 tmp = __plt2__ (h, x, y, options, properties); | |
11421
a451eb6f92b2
__plt__.m: Fix to allow inline legend keys. Bug 31991.
Ben Abbott <bpabbott@mac.com>
parents:
11000
diff
changeset
|
101 [hlgnd, tlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd); |
10549 | 102 retval = [retval; tmp]; |
103 x = next_arg; | |
104 y_set = false; | |
105 properties = {}; | |
106 else | |
107 y = next_arg; | |
108 y_set = true; | |
109 endif | |
5116 | 110 else |
10549 | 111 x = next_arg; |
112 x_set = true; | |
4 | 113 endif |
934 | 114 |
5118 | 115 endwhile |
934 | 116 |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
117 if (!isempty (hlgnd)) |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
118 legend (gca(), hlgnd, tlgnd); |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
119 endif |
4 | 120 else |
10730
390d93e20531
Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents:
10679
diff
changeset
|
121 error ("__plt__: invalid number of arguments"); |
4 | 122 endif |
123 | |
6004 | 124 endfunction |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
125 |
11421
a451eb6f92b2
__plt__.m: Fix to allow inline legend keys. Bug 31991.
Ben Abbott <bpabbott@mac.com>
parents:
11000
diff
changeset
|
126 function [hlgnd, tlgnd] = __plt_key__ (h, options, hlgnd, tlgnd) |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
127 n = numel (h); |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
128 if (numel (options) == 1) |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
129 options = repmat (options(:), n, 1); |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
130 endif |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
131 |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
132 for i = 1 : n |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
133 key = options.key; |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
134 if (! isempty (key)) |
11462
aed2c50c3082
legend.m: legend with more than two inline keys (bug 31991). Add/modifyy demos.
Ben Abbott <bpabbott@mac.com>
parents:
11421
diff
changeset
|
135 hlgnd = [hlgnd(:); h(i)]; |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
136 tlgnd = {tlgnd{:}, key}; |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
137 endif |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
138 endfor |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
139 endfunction |
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
140 |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
141 function retval = __plt1__ (h, x1, options, properties) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
142 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
143 if (nargin < 2 || nargin > 4) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
144 print_usage (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
145 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
146 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
147 if (nargin < 3 || isempty (options)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
148 options = __default_plot_options__ (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
149 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
150 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
151 if (nargin < 4) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
152 properties = {}; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
153 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
154 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
155 if (! isstruct (options)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
156 error ("__plt1__: options must be a struct array"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
157 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
158 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
159 [nr, nc] = size (x1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
160 if (nr == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
161 x1 = x1.'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
162 tmp = nr; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
163 nr = nc; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
164 nc = tmp; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
165 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
166 x1_i = imag (x1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
167 if (any (any (x1_i))) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
168 x2 = x1_i; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
169 x1 = real (x1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
170 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
171 x2 = x1; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
172 x1 = (1:nr)'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
173 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
174 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
175 retval = __plt2__ (h, x1, x2, options, properties); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
176 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
177 endfunction |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
178 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
179 function retval = __plt2__ (h, x1, x2, options, properties) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
180 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
181 if (nargin < 3 || nargin > 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
182 print_usage (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
183 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
184 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
185 if (nargin < 4 || isempty (options)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
186 options = __default_plot_options__ (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
187 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
188 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
189 if (nargin < 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
190 properties = {}; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
191 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
192 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
193 if (! isstruct (options)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
194 error ("__plt1__: options must be a struct array"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
195 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
196 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
197 if (any (any (imag (x1)))) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
198 x1 = real (x1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
199 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
200 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
201 if (any (any (imag (x2)))) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
202 x2 = real (x2); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
203 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
204 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
205 h_set = false; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
206 if (isempty (x1) && isempty (x2)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
207 retval = zeros (0, 1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
208 elseif (isscalar (x1)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
209 if (isscalar (x2)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
210 retval = __plt2ss__ (h, x1, x2, options, properties); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
211 elseif (isvector (x2)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
212 retval = __plt2sv__ (h, x1, x2, options, properties); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
213 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
214 error ("__plt2__: invalid data for plotting"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
215 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
216 elseif (isvector (x1)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
217 if (isscalar (x2)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
218 retval = __plt2vs__ (h, x1, x2, options, properties); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
219 elseif (isvector (x2)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
220 retval = __plt2vv__ (h, x1, x2, options, properties); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
221 elseif (ismatrix (x2)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
222 retval = __plt2vm__ (h, x1, x2, options, properties); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
223 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
224 error ("__plt2__: invalid data for plotting"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
225 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
226 elseif (ismatrix (x1)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
227 if (isvector (x2)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
228 retval = __plt2mv__ (h, x1, x2, options, properties); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
229 elseif (ismatrix (x2)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
230 retval = __plt2mm__ (h, x1, x2, options, properties); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
231 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
232 error ("__plt2__: invalid data for plotting"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
233 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
234 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
235 error ("__plt2__: invalid data for plotting"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
236 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
237 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
238 endfunction |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
239 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
240 function retval = __plt2mm__ (h, x, y, options, properties) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
241 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
242 if (nargin < 3 || nargin > 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
243 print_usage (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
244 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
245 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
246 if (nargin < 4 || isempty (options)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
247 options = __default_plot_options__ (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
248 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
249 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
250 if (nargin < 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
251 properties = {}; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
252 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
253 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
254 [x_nr, x_nc] = size (x); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
255 [y_nr, y_nc] = size (y); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
256 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
257 k = 1; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
258 if (x_nr == y_nr && x_nc == y_nc) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
259 if (x_nc > 0) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
260 if (numel (options) == 1) |
10549 | 261 options = repmat (options(:), x_nc, 1); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
262 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
263 retval = zeros (x_nc, 1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
264 for i = 1:x_nc |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
265 linestyle = options(i).linestyle; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
266 marker = options(i).marker; |
10549 | 267 if (isempty (marker) && isempty (linestyle)) |
268 [linestyle, marker] = __next_line_style__ (); | |
269 endif | |
270 color = options(i).color; | |
271 if (isempty (color)) | |
272 color = __next_line_color__ (); | |
273 endif | |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
274 |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
275 retval(i) = line (x(:,i), y(:,i), "color", color, |
10549 | 276 "linestyle", linestyle, |
277 "marker", marker, properties{:}); | |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
278 endfor |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
279 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
280 error ("__plt2mm__: arguments must be a matrices"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
281 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
282 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
283 error ("__plt2mm__: matrix dimensions must match"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
284 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
285 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
286 endfunction |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
287 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
288 function retval = __plt2mv__ (h, x, y, options, properties) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
289 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
290 if (nargin < 3 || nargin > 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
291 print_usage (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
292 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
293 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
294 if (nargin < 4 || isempty (options)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
295 options = __default_plot_options__ (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
296 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
297 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
298 if (nargin < 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
299 properties = {}; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
300 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
301 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
302 [x_nr, x_nc] = size (x); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
303 [y_nr, y_nc] = size (y); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
304 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
305 if (y_nr == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
306 y = y'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
307 tmp = y_nr; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
308 y_nr = y_nc; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
309 y_nc = tmp; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
310 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
311 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
312 if (x_nr == y_nr) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
313 1; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
314 elseif (x_nc == y_nr) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
315 x = x'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
316 tmp = x_nr; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
317 x_nr = x_nc; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
318 x_nc = tmp; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
319 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
320 error ("__plt2mv__: matrix dimensions must match"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
321 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
322 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
323 if (x_nc > 0) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
324 if (numel (options) == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
325 options = repmat (options(:), x_nc, 1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
326 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
327 retval = zeros (x_nc, 1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
328 for i = 1:x_nc |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
329 linestyle = options(i).linestyle; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
330 marker = options(i).marker; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
331 if (isempty (marker) && isempty (linestyle)) |
10549 | 332 [linestyle, marker] = __next_line_style__ (); |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
333 endif |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
334 color = options(i).color; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
335 if (isempty (color)) |
10549 | 336 color = __next_line_color__ (); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
337 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
338 |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
339 retval(i) = line (x(:,i), y, "color", color, |
10549 | 340 "linestyle", linestyle, |
341 "marker", marker, properties{:}); | |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
342 endfor |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
343 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
344 error ("__plt2mv__: arguments must be a matrices"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
345 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
346 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
347 endfunction |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
348 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
349 function retval = __plt2ss__ (h, x, y, options, properties) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
350 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
351 if (nargin < 3 || nargin > 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
352 print_usage (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
353 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
354 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
355 if (nargin < 4 || isempty (options)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
356 options = __default_plot_options__ (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
357 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
358 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
359 if (nargin < 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
360 properties = {}; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
361 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
362 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
363 if (numel (options) > 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
364 options = options(1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
365 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
366 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
367 [x_nr, x_nc] = size (x); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
368 [y_nr, y_nc] = size (y); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
369 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
370 if (x_nr == 1 && x_nr == y_nr && x_nc == 1 && x_nc == y_nc) |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
371 linestyle = options.linestyle; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
372 marker = options.marker; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
373 if (isempty (marker) && isempty (linestyle)) |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
374 [linestyle, marker] = __next_line_style__ (); |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
375 endif |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
376 color = options.color; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
377 if (isempty (color)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
378 color = __next_line_color__ (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
379 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
380 |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
381 retval = line (x, y, "color", color, |
10549 | 382 "linestyle", linestyle, |
383 "marker", marker, properties{:}); | |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
384 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
385 error ("__plt2ss__: arguments must be scalars"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
386 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
387 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
388 endfunction |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
389 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
390 function retval = __plt2sv__ (h, x, y, options, properties) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
391 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
392 if (nargin < 3 || nargin > 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
393 print_usage (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
394 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
395 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
396 if (nargin < 4 || isempty (options)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
397 options = __default_plot_options__ (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
398 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
399 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
400 if (nargin < 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
401 properties = {}; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
402 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
403 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
404 if (isscalar (x) && isvector (y)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
405 len = numel (y); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
406 if (numel (options) == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
407 options = repmat (options(:), len, 1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
408 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
409 retval = zeros (len, 1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
410 for i = 1:len |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
411 linestyle = options(i).linestyle; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
412 marker = options(i).marker; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
413 if (isempty (marker) && isempty (linestyle)) |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
414 [linestyle, marker] = __next_line_style__ (); |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
415 endif |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
416 color = options(i).color; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
417 if (isempty (color)) |
10549 | 418 color = __next_line_color__ (); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
419 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
420 |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
421 retval(i) = line (x, y(i), "color", color, |
10549 | 422 "linestyle", linestyle, |
423 "marker", marker, properties{:}); | |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
424 endfor |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
425 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
426 error ("__plt2sv__: first arg must be scalar, second arg must be vector"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
427 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
428 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
429 endfunction |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
430 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
431 function retval = __plt2vm__ (h, x, y, options, properties) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
432 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
433 if (nargin < 3 || nargin > 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
434 print_usage (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
435 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
436 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
437 if (nargin < 4 || isempty (options)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
438 options = __default_plot_options__ (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
439 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
440 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
441 if (nargin < 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
442 properties = {}; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
443 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
444 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
445 [x_nr, x_nc] = size (x); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
446 [y_nr, y_nc] = size (y); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
447 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
448 if (x_nr == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
449 x = x'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
450 tmp = x_nr; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
451 x_nr = x_nc; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
452 x_nc = tmp; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
453 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
454 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
455 if (x_nr == y_nr) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
456 1; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
457 elseif (x_nr == y_nc) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
458 y = y'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
459 tmp = y_nr; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
460 y_nr = y_nc; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
461 y_nc = tmp; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
462 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
463 error ("__plt2vm__: matrix dimensions must match"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
464 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
465 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
466 if (y_nc > 0) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
467 if (numel (options) == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
468 options = repmat (options(:), y_nc, 1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
469 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
470 retval = zeros (y_nc, 1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
471 for i = 1:y_nc |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
472 linestyle = options(i).linestyle; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
473 marker = options(i).marker; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
474 if (isempty (marker) && isempty (linestyle)) |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
475 [linestyle, marker] = __next_line_style__ (); |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
476 endif |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
477 color = options(i).color; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
478 if (isempty (color)) |
10549 | 479 color = __next_line_color__ (); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
480 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
481 |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
482 retval(i) = line (x, y(:,i), "color", color, |
10549 | 483 "linestyle", linestyle, |
484 "marker", marker, properties{:}); | |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
485 endfor |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
486 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
487 error ("__plt2vm__: arguments must be a matrices"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
488 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
489 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
490 endfunction |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
491 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
492 function retval = __plt2vs__ (h, x, y, options, properties) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
493 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
494 if (nargin < 3 || nargin > 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
495 print_usage (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
496 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
497 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
498 if (nargin < 4 || isempty (options)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
499 options = __default_plot_options__ (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
500 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
501 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
502 if (nargin < 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
503 properties = {}; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
504 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
505 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
506 if (isvector (x) && isscalar (y)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
507 len = numel (x); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
508 if (numel (options) == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
509 options = repmat (options(:), len, 1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
510 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
511 retval = zeros (len, 1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
512 for i = 1:len |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
513 linestyle = options(i).linestyle; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
514 marker = options(i).marker; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
515 if (isempty (marker) && isempty (linestyle)) |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
516 [linestyle, marker] = __next_line_style__ (); |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
517 endif |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
518 color = options(i).color; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
519 if (isempty (color)) |
10549 | 520 color = __next_line_color__ (); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
521 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
522 |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
523 retval(i) = line (x(i), y, "color", color, |
10549 | 524 "linestyle", linestyle, |
525 "marker", marker, properties{:}); | |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
526 endfor |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
527 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
528 error ("__plt2vs__: first arg must be vector, second arg must be scalar"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
529 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
530 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
531 endfunction |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
532 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
533 function retval = __plt2vv__ (h, x, y, options, properties) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
534 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
535 if (nargin < 3 || nargin > 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
536 print_usage (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
537 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
538 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
539 if (nargin < 4 || isempty (options)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
540 options = __default_plot_options__ (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
541 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
542 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
543 if (nargin < 5) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
544 properties = {}; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
545 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
546 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
547 if (numel (options) > 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
548 options = options(1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
549 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
550 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
551 [x_nr, x_nc] = size (x); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
552 [y_nr, y_nc] = size (y); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
553 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
554 if (x_nr == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
555 x = x'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
556 tmp = x_nr; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
557 x_nr = x_nc; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
558 x_nc = tmp; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
559 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
560 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
561 if (y_nr == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
562 y = y'; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
563 tmp = y_nr; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
564 y_nr = y_nc; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
565 y_nc = tmp; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
566 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
567 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
568 if (x_nr == y_nr) |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
569 linestyle = options.linestyle; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
570 marker = options.marker; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
571 if (isempty (marker) && isempty (linestyle)) |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
572 [linestyle, marker] = __next_line_style__ (); |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
573 endif |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
574 color = options.color; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
575 if (isempty (color)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
576 color = __next_line_color__ (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
577 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
578 |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10730
diff
changeset
|
579 retval = line (x, y, "color", color, |
10549 | 580 "linestyle", linestyle, |
581 "marker", marker, properties{:}); | |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
582 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
583 error ("__plt2vv__: vector lengths must match"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
584 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
585 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
586 endfunction |