Mercurial > hg > octave-lyh
annotate scripts/plot/__plt2sv__.m @ 8070:3b53b25e2550
Add data sources and line series
author | David Bateman <dbateman@free.fr> |
---|---|
date | Thu, 28 Aug 2008 12:23:54 -0400 |
parents | 1edef460c5fe |
children | a028a5960e18 |
rev | line source |
---|---|
7431 | 1 ## Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2003, 2005, |
2 ## 2006, 2007 John W. Eaton | |
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 | |
8 ## the Free Software Foundation; either version 3 of the License, or (at | |
9 ## your option) any later version. | |
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 | |
17 ## along with Octave; see the file COPYING. If not, see | |
18 ## <http://www.gnu.org/licenses/>. | |
19 | |
20 ## Undocumented internal function. | |
21 | |
22 ## Author: jwe | |
23 | |
24 function retval = __plt2sv__ (h, x, y, options, properties) | |
25 | |
26 if (nargin < 3 || nargin > 5) | |
27 print_usage (); | |
28 endif | |
29 | |
30 if (nargin < 4 || isempty (options)) | |
31 options = __default_plot_options__ (); | |
32 endif | |
33 | |
34 if (nargin < 5) | |
35 properties = {}; | |
36 endif | |
37 | |
38 if (isscalar (x) && isvector (y)) | |
39 len = numel (y); | |
40 if (numel (options) == 1) | |
41 options = repmat (options(:), len, 1); | |
42 endif | |
43 retval = zeros (len, 1); | |
44 for i = 1:len | |
45 tkey = options(i).key; | |
46 if (! isempty (tkey)) | |
47 set (h, "key", "on"); | |
48 endif | |
49 color = options(i).color; | |
50 if (isempty (color)) | |
51 color = __next_line_color__ (); | |
52 endif | |
8070
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
7431
diff
changeset
|
53 |
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
7431
diff
changeset
|
54 hg = hggroup (); |
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
7431
diff
changeset
|
55 retval(i) = hg; |
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
7431
diff
changeset
|
56 args = __add_datasource__ ("__plt2sv__", hg, {"x", "y", "z"}, |
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
7431
diff
changeset
|
57 properties{:}); |
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
7431
diff
changeset
|
58 |
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
7431
diff
changeset
|
59 h = line (x, y(i), "keylabel", tkey, "color", color, |
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
7431
diff
changeset
|
60 "linestyle", options(i).linestyle, |
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
7431
diff
changeset
|
61 "marker", options(i).marker, "parent", hg, args{:}); |
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
7431
diff
changeset
|
62 |
3b53b25e2550
Add data sources and line series
David Bateman <dbateman@free.fr>
parents:
7431
diff
changeset
|
63 __add_line_series__ (h, hg); |
7431 | 64 endfor |
65 else | |
66 error ("__plt2sv__: first arg must be scalar, second arg must be vector"); | |
67 endif | |
68 | |
69 endfunction |