Mercurial > hg > octave-lyh
comparison scripts/plot/__plt2mm__.m @ 6264:cc2bee854d23
[project @ 2007-02-01 10:00:05 by jwe]
author | jwe |
---|---|
date | Thu, 01 Feb 2007 10:00:05 +0000 |
parents | 44c91c5dfe1d |
children | a5cd8b77e892 |
comparison
equal
deleted
inserted
replaced
6263:d60127449a29 | 6264:cc2bee854d23 |
---|---|
16 ## along with Octave; see the file COPYING. If not, write to the Free | 16 ## along with Octave; see the file COPYING. If not, write to the Free |
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 ## 02110-1301, USA. | 18 ## 02110-1301, USA. |
19 | 19 |
20 ## -*- texinfo -*- | 20 ## -*- texinfo -*- |
21 ## @deftypefn {Function File} {} __plt2mm__ (@var{h}, @var{x}, @var{y}, @var{fmt}, @var{key}) | 21 ## @deftypefn {Function File} {} __plt2mm__ (@var{h}, @var{x}, @var{y}, @var{options}) |
22 ## @end deftypefn | 22 ## @end deftypefn |
23 | 23 |
24 ## Author: jwe | 24 ## Author: jwe |
25 | 25 |
26 function __plt2mm__ (h, x, y, fmt, key) | 26 function __plt2mm__ (h, x, y, options) |
27 | 27 |
28 if (nargin < 3 || nargin > 5) | 28 if (nargin < 3 || nargin > 4) |
29 print_usage (); | 29 print_usage (); |
30 endif | 30 endif |
31 | 31 |
32 if (nargin < 4 || isempty (fmt)) | 32 if (nargin < 4 || isempty (options)) |
33 fmt = {""}; | 33 options = __default_plot_options__ (); |
34 endif | |
35 | |
36 if (nargin < 5 || isempty (key)) | |
37 key = {""}; | |
38 endif | 34 endif |
39 | 35 |
40 [x_nr, x_nc] = size (x); | 36 [x_nr, x_nc] = size (x); |
41 [y_nr, y_nc] = size (y); | 37 [y_nr, y_nc] = size (y); |
42 | 38 |
43 k = 1; | 39 k = 1; |
44 fmt_nr = rows (fmt); | |
45 if (x_nr == y_nr && x_nc == y_nc) | 40 if (x_nr == y_nr && x_nc == y_nc) |
46 if (x_nc > 0) | 41 if (x_nc > 0) |
47 if (rows (fmt) == 1) | 42 if (numel (options) == 1) |
48 fmt = repmat (fmt, x_nc, 1); | 43 options = repmat (options(:), x_nc, 1); |
49 endif | |
50 if (rows (key) == 1) | |
51 key = repmat (key, x_nc, 1); | |
52 endif | 44 endif |
53 for i = 1:x_nc | 45 for i = 1:x_nc |
54 ## FIXME -- need to handle labels and line format. | 46 tkey = options(i).key; |
55 tkey = key{i}; | |
56 if (! isempty (tkey)) | 47 if (! isempty (tkey)) |
57 set (h, "key", "on"); | 48 set (h, "key", "on"); |
58 endif | 49 endif |
59 line (x(:,i), y(:,i), "keylabel", tkey); | 50 color = options(i).color; |
51 if (isempty (color)) | |
52 color = __next_line_color__ (); | |
53 endif | |
54 line (x(:,i), y(:,i), "keylabel", tkey, "color", color, | |
55 "linestyle", options(i).linestyle, | |
56 "marker", options(i).marker); | |
60 endfor | 57 endfor |
61 else | 58 else |
62 error ("__plt2mm__: arguments must be a matrices"); | 59 error ("__plt2mm__: arguments must be a matrices"); |
63 endif | 60 endif |
64 else | 61 else |