Mercurial > hg > octave-nkf
annotate scripts/plot/__plt__.m @ 9245:16f53d29049f
update copyright notices
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 22 May 2009 10:46:00 -0400 |
parents | eb63fbe60fab |
children |
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 |
5116 | 40 ## Gather arguments, decode format, gather plot strings, and plot lines. |
934 | 41 |
6405 | 42 retval = []; |
43 | |
6257 | 44 while (nargs > 0 || x_set) |
5115 | 45 |
5119 | 46 if (nargs == 0) |
47 ## Force the last plot when input variables run out. | |
6459 | 48 next_cell = {}; |
6146 | 49 next_arg = {""}; |
5118 | 50 else |
6459 | 51 next_cell = varargin(k); |
5119 | 52 next_arg = varargin{k++}; |
5116 | 53 endif |
934 | 54 |
6257 | 55 nargs--; |
56 | |
6146 | 57 if (ischar (next_arg) || iscellstr (next_arg)) |
5119 | 58 if (x_set) |
6459 | 59 [options, valid] = __pltopt__ (caller, next_arg, false); |
60 if (! valid) | |
61 if (nargs == 0) | |
62 error ("%s: properties must appear followed by a value", caller); | |
63 endif | |
64 properties = [properties, [next_cell, varargin(k++)]]; | |
65 nargs--; | |
66 continue; | |
67 else | |
68 while (nargs > 0 && ischar (varargin{k})) | |
69 if (nargs < 2) | |
70 error ("%s: properties must appear followed by a value", | |
71 caller); | |
72 endif | |
73 properties = [properties, varargin(k:k+1)]; | |
74 k += 2; | |
75 nargs -= 2; | |
76 endwhile | |
77 endif | |
5119 | 78 if (y_set) |
6459 | 79 tmp = __plt2__ (h, x, y, options, properties); |
80 properties = {}; | |
6405 | 81 retval = [retval; tmp]; |
5119 | 82 else |
6459 | 83 tmp = __plt1__ (h, x, options, properties); |
84 properties = {}; | |
6405 | 85 retval = [retval; tmp]; |
5741 | 86 endif |
5119 | 87 x_set = false; |
88 y_set = false; | |
89 else | |
5116 | 90 error ("plot: no data to plot"); |
91 endif | |
92 elseif (x_set) | |
93 if (y_set) | |
6264 | 94 options = __pltopt__ (caller, {""}); |
6459 | 95 tmp = __plt2__ (h, x, y, options, properties); |
6405 | 96 retval = [retval; tmp]; |
5119 | 97 x = next_arg; |
98 y_set = false; | |
6459 | 99 properties = {}; |
5116 | 100 else |
5119 | 101 y = next_arg; |
102 y_set = true; | |
5116 | 103 endif |
104 else | |
5119 | 105 x = next_arg; |
106 x_set = true; | |
4 | 107 endif |
934 | 108 |
5118 | 109 endwhile |
934 | 110 |
4 | 111 else |
5119 | 112 msg = sprintf ("%s (y)\n", caller); |
113 msg = sprintf ("%s %s (x, y, ...)\n", msg, caller); | |
114 msg = sprintf ("%s %s (x, y, fmt, ...)", msg, caller); | |
6459 | 115 msg = sprintf ("%s %s (x, y, property, value, ...)", msg, caller); |
934 | 116 usage (msg); |
4 | 117 endif |
118 | |
6004 | 119 endfunction |
6459 | 120 |