Mercurial > jwe > octave
annotate scripts/plot/util/__pltopt__.m @ 31040:7c4e580bc103 stable
plot: Deprecate using numbers to select line colors (bug #62470).
* scripts/plot/util/__pltopt__.m (decode_linespec): Deprecate un-documented
marker style and color identifiers.
* etc/NEWS.7.md: Add note about deprecated feature to NEWS file.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 27 May 2022 15:57:08 +0200 |
parents | 399925c27b7c |
children | a357490263f6 |
rev | line source |
---|---|
27928
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27924
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27924
diff
changeset
|
2 ## |
30569
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30258
diff
changeset
|
3 ## Copyright (C) 1994-2022 The Octave Project Developers |
27923
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27903
diff
changeset
|
4 ## |
27928
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27924
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27924
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
2313 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
2313 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
2313 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
2313 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
7016 | 21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27928
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27924
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27924
diff
changeset
|
24 ######################################################################## |
933 | 25 |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
26 ## -*- texinfo -*- |
25039
40a65b30fadf
maint: Match variable names in documentation to those in function prototype.
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
27 ## @deftypefn {} {} __pltopt__ (@var{caller}, @var{opt}, @var{err_on_invalid}) |
6895 | 28 ## |
2311 | 29 ## Decode plot option strings. |
30 ## | |
3449 | 31 ## @var{opt} can currently be some combination of the following: |
2311 | 32 ## |
28937
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
33 ## @table @asis |
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
34 ## @item @qcode{"-"} |
6267 | 35 ## For solid linestyle (default). |
3717 | 36 ## |
28937
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
37 ## @item @qcode{"--"} |
6267 | 38 ## For dashed line style. |
3717 | 39 ## |
28937
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
40 ## @item @qcode{"-."} |
3717 | 41 ## For linespoints plot style. |
42 ## | |
28937
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
43 ## @item @qcode{":"} |
6267 | 44 ## For dots plot style. |
3717 | 45 ## |
29115
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
46 ## @item @qcode{"r"} |
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
47 ## @itemx @qcode{"red"} |
6267 | 48 ## Red line color. |
3717 | 49 ## |
29115
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
50 ## @item @qcode{"g"} |
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
51 ## @itemx @qcode{"green"} |
6267 | 52 ## Green line color. |
3717 | 53 ## |
29115
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
54 ## @item @qcode{"b"} |
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
55 ## @itemx @qcode{"blue"} |
6267 | 56 ## Blue line color. |
3717 | 57 ## |
29115
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
58 ## @item @qcode{"c"} |
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
59 ## @itemx @qcode{"cyan"} |
6267 | 60 ## Cyan line color. |
3717 | 61 ## |
29115
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
62 ## @item @qcode{"m"} |
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
63 ## @itemx @qcode{"magenta"} |
6267 | 64 ## Magenta line color. |
4006 | 65 ## |
29115
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
66 ## @item @qcode{"y"} |
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
67 ## @itemx @qcode{"yellow"} |
6267 | 68 ## Yellow line color. |
3717 | 69 ## |
29115
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
70 ## @item @qcode{"k"} |
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
71 ## @itemx @qcode{"black"} |
6267 | 72 ## Black line color. |
3717 | 73 ## |
29115
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
74 ## @item @qcode{"w"} |
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
75 ## @itemx @qcode{"white"} |
6267 | 76 ## White line color. |
3717 | 77 ## |
29115
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
78 ## @item @qcode{";displayname;"} |
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
79 ## The text between semicolons is used to set the @qcode{"displayname"} |
2fa4d47eb6f7
__pltopt__.m: Document long-form color specifications.
Rik <rik@octave.org>
parents:
29111
diff
changeset
|
80 ## property which determines the label used for the plot legend. |
3717 | 81 ## |
28937
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
82 ## @item @qcode{"+"} |
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
83 ## @itemx @qcode{"o"} |
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
84 ## @itemx @qcode{"*"} |
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
85 ## @itemx @qcode{"."} |
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
86 ## @itemx @qcode{"x"} |
30258
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
29364
diff
changeset
|
87 ## @itemx @qcode{"|"} |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
29364
diff
changeset
|
88 ## @itemx @qcode{"_"} |
28937
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
89 ## @itemx @qcode{"s"} |
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
90 ## @itemx @qcode{"d"} |
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
91 ## @itemx @qcode{"^"} |
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
92 ## @itemx @qcode{"v"} |
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
93 ## @itemx @qcode{">"} |
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
94 ## @itemx @qcode{"<"} |
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
95 ## @itemx @qcode{"p"} |
ec6fbdc9b6a9
__pltopt__.m: Use @qcode in texinfo documentation.
Rik <rik@octave.org>
parents:
27989
diff
changeset
|
96 ## @itemx @qcode{"h"} |
3717 | 97 ## Used in combination with the points or linespoints styles, set the point |
98 ## style. | |
3449 | 99 ## @end table |
2311 | 100 ## |
25039
40a65b30fadf
maint: Match variable names in documentation to those in function prototype.
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
101 ## @end deftypefn |
933 | 102 |
17462
177147bf7b55
Overhaul use of __pltopt__.m to correctly check for cellstr, not just cell.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
103 function [options, valid] = __pltopt__ (caller, opt, err_on_invalid = true) |
933 | 104 |
17176
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
105 if (ischar (opt)) |
17462
177147bf7b55
Overhaul use of __pltopt__.m to correctly check for cellstr, not just cell.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
106 opt = cellstr (opt); |
177147bf7b55
Overhaul use of __pltopt__.m to correctly check for cellstr, not just cell.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
107 elseif (! iscellstr (opt)) |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
108 ## FIXME: This is an internal function. Can't we rely on valid input? |
17176
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
109 error ("__pltopt__: argument must be a character string or cell array of character strings"); |
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
110 endif |
17462
177147bf7b55
Overhaul use of __pltopt__.m to correctly check for cellstr, not just cell.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
111 |
177147bf7b55
Overhaul use of __pltopt__.m to correctly check for cellstr, not just cell.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
112 nel = numel (opt); |
177147bf7b55
Overhaul use of __pltopt__.m to correctly check for cellstr, not just cell.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
113 |
29132
a948253f9976
maint: strip trailing spaces from code base.
Rik <rik@octave.org>
parents:
29115
diff
changeset
|
114 if (nel) |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
115 for i = nel:-1:1 |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
116 [options(i), valid] = decode_linespec (caller, opt{i}, err_on_invalid); |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
117 if (! err_on_invalid && ! valid) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
118 return; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
119 endif |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
120 endfor |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
121 else |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
122 options = __default_plot_options__ (); |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
123 valid = true; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
124 endif |
933 | 125 |
126 endfunction | |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
127 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
128 ## Really decode plot option strings. |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
129 function [options, valid] = decode_linespec (caller, opt, err_on_invalid) |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
130 |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
131 persistent default_options = __default_plot_options__ (); |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
132 |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
133 options = default_options; |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
134 valid = true; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
135 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
136 have_linestyle = false; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
137 have_marker = false; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
138 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
139 ## If called by __errplot__, extract the linestyle before proceeding. |
20401
905fc6b85b4c
build: Consolidate __errcomm__.m and __errplot__.m to one file.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
140 if (strcmp (caller, "__do_errplot__")) |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
141 if (strncmp (opt, "#~>", 3)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
142 n = 3; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
143 elseif (strncmp (opt, "#~", 2) || strncmp (opt, "~>", 2)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
144 n = 2; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
145 elseif (strncmp (opt, "~", 1) || strncmp (opt, ">", 1) |
10549 | 146 || strncmp (opt, "#", 1)) |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
147 n = 1; |
10575
3eba2cc7cbda
Allow matlab style linestyles in errorbar plots
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
148 else |
3eba2cc7cbda
Allow matlab style linestyles in errorbar plots
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
149 n = 0; |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
150 endif |
10580
1479b93ee655
Respect linestyleorder in errorbar plots
David Bateman <dbateman@free.fr>
parents:
10575
diff
changeset
|
151 options.errorstyle = opt(1:n); |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
152 opt(1:n) = []; |
10580
1479b93ee655
Respect linestyleorder in errorbar plots
David Bateman <dbateman@free.fr>
parents:
10575
diff
changeset
|
153 else |
1479b93ee655
Respect linestyleorder in errorbar plots
David Bateman <dbateman@free.fr>
parents:
10575
diff
changeset
|
154 options.errorstyle = "~"; |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
155 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
156 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
157 while (! isempty (opt)) |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
158 topt = opt(1); |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
159 n = 1; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
160 |
31040
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
161 if (any (topt == "0":"6")) |
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
162 warning ("Octave:deprecated-option", ... |
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
163 ["%s: using numbers to select line colors is deprecated. ", ... |
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
164 "Use the corresponding color identifier instead."], caller); |
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
165 endif |
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
166 |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
167 ## LineStyles |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
168 if (strncmp (opt, "--", 2) || strncmp (opt, "-.", 2)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
169 options.linestyle = opt(1:2); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
170 have_linestyle = true; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
171 n = 2; |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
172 elseif (topt == "-" || topt == ":") |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
173 have_linestyle = true; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
174 options.linestyle = topt; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
175 ## Markers |
30258
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
29364
diff
changeset
|
176 elseif (any (topt == "+o*.x|_sd^v><ph")) |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
177 have_marker = true; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
178 ## Check for long form marker styles |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
179 if (any (topt == "sdhp")) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
180 if (strncmp (opt, "square", 6)) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
181 n = 6; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
182 elseif (strncmp (opt, "diamond", 7)) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
183 n = 7; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
184 elseif (strncmp (opt, "hexagram", 8)) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
185 n = 8; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
186 elseif (strncmp (opt, "pentagram", 9)) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
187 n = 9; |
10549 | 188 endif |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
189 endif |
31040
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
190 ## Backward compatibility. Leave undocumented. |
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
191 if (topt == "@") |
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
192 warning ("Octave:deprecated-option", ... |
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
193 "%s: marker type '@' is deprecated. Use '+' instead.", ... |
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
194 caller); |
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
195 topt = "+"; |
7c4e580bc103
plot: Deprecate using numbers to select line colors (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31039
diff
changeset
|
196 endif |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
197 options.marker = topt; |
31039
399925c27b7c
Backout changeset 014d2710dcd5 (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30569
diff
changeset
|
198 ## Numeric color specs are for backward compatibility. Don't document. |
399925c27b7c
Backout changeset 014d2710dcd5 (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30569
diff
changeset
|
199 elseif (topt == "k" || topt == "0") |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
200 options.color = [0, 0, 0]; |
31039
399925c27b7c
Backout changeset 014d2710dcd5 (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30569
diff
changeset
|
201 elseif (topt == "r" || topt == "1") |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
202 if (strncmp (opt, "red", 3)) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
203 n = 3; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
204 endif |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
205 options.color = [1, 0, 0]; |
31039
399925c27b7c
Backout changeset 014d2710dcd5 (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30569
diff
changeset
|
206 elseif (topt == "g" || topt == "2") |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
207 if (strncmp (opt, "green", 5)) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
208 n = 5; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
209 endif |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
210 options.color = [0, 1, 0]; |
31039
399925c27b7c
Backout changeset 014d2710dcd5 (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30569
diff
changeset
|
211 elseif (topt == "b" || topt == "3") |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
212 if (strncmp (opt, "black", 5)) |
10549 | 213 options.color = [0, 0, 0]; |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
214 n = 5; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
215 elseif (strncmp (opt, "blue", 4)) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
216 options.color = [0, 0, 1]; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
217 n = 4; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
218 else |
10549 | 219 options.color = [0, 0, 1]; |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
220 endif |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
221 elseif (topt == "y") |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
222 if (strncmp (opt, "yellow", 6)) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
223 n = 6; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
224 endif |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
225 options.color = [1, 1, 0]; |
31039
399925c27b7c
Backout changeset 014d2710dcd5 (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30569
diff
changeset
|
226 elseif (topt == "m" || topt == "4") |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
227 if (strncmp (opt, "magenta", 7)) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
228 n = 7; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
229 endif |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
230 options.color = [1, 0, 1]; |
31039
399925c27b7c
Backout changeset 014d2710dcd5 (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30569
diff
changeset
|
231 elseif (topt == "c" || topt == "5") |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
232 if (strncmp (opt, "cyan", 4)) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
233 n = 4; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
234 endif |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
235 options.color = [0, 1, 1]; |
31039
399925c27b7c
Backout changeset 014d2710dcd5 (bug #62470).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30569
diff
changeset
|
236 elseif (topt == "w" || topt == "6") |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
237 if (strncmp (opt, "white", 5)) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
238 n = 5; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
239 endif |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
240 options.color = [1, 1, 1]; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
241 elseif (isspace (topt)) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
242 ## Do nothing. |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
243 elseif (topt == ";") |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
244 t = index (opt(2:end), ";"); |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
245 if (t) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
246 options.key = opt(2:t); |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
247 n = t+1; |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
248 else |
10549 | 249 if (err_on_invalid) |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
250 error ("%s: unfinished key label", caller); |
10549 | 251 else |
252 valid = false; | |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
253 options = default_options; |
10549 | 254 return; |
255 endif | |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
256 endif |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
257 else |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
258 if (err_on_invalid) |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
259 error ("%s: unrecognized format character: '%s'", caller, topt); |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
260 else |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
261 valid = false; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
262 options = default_options; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
263 return; |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
264 endif |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
265 endif |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
266 |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
267 opt(1:n) = []; # Delete decoded portion |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
268 endwhile |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
269 |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
270 if (! have_linestyle && have_marker) |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
271 options.linestyle = "none"; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
272 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
273 |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
274 if (have_linestyle && ! have_marker) |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
275 options.marker = "none"; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
276 endif |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
277 |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
278 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17176
diff
changeset
|
279 |
19171
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
280 |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
281 ## Only cursory testing. Real testing done by appearance of plots. |
20929
45a64a6c7273
fix comment character style in most .m files to be consistent
John W. Eaton <jwe@octave.org>
parents:
20852
diff
changeset
|
282 %!test |
19171
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
283 %! opts = __pltopt__ ("abc", ""); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
284 %! assert (opts.color, []); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
285 %! assert (opts.linestyle, []); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
286 %! assert (opts.marker, []); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
287 %! assert (opts.key, ""); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
288 %!test |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
289 %! opts = __pltopt__ ("abc", "r:x"); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
290 %! assert (opts.color, [1 0 0]); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
291 %! assert (opts.linestyle, ":"); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
292 %! assert (opts.marker, "x"); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
293 %!test |
29111
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
294 %! opts = __pltopt__ ("abc", "-.blackx"); |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
295 %! assert (opts.color, [0 0 0]); |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
296 %! assert (opts.linestyle, "-."); |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
297 %! assert (opts.marker, "x"); |
c661350ee8df
__pltopt__.m: Overhaul function and add support for long color names (bug #59534).
Rik <rik@octave.org>
parents:
29106
diff
changeset
|
298 %!test |
29105
014d2710dcd5
__pltopt__.m: Remove ancient code supporting numeric values for colors in LineSpec.
Rik <rik@octave.org>
parents:
28937
diff
changeset
|
299 %! opts = __pltopt__ ("abc", "gsquare"); |
19171
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
300 %! assert (opts.color, [0 1 0]); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
301 %! assert (opts.linestyle, "none"); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
302 %! assert (opts.marker, "s"); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
303 %!test |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
304 %! opts = __pltopt__ ("abc", ";Title;"); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
305 %! assert (opts.key, "Title"); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
306 %! assert (opts.color, []); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
307 %! assert (opts.linestyle, []); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
308 %! assert (opts.marker, []); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
309 %!test |
20401
905fc6b85b4c
build: Consolidate __errcomm__.m and __errplot__.m to one file.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
310 %! opts = __pltopt__ ("__do_errplot__", "~>r"); |
19171
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
311 %! assert (opts.errorstyle, "~>"); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
312 %! assert (opts.color, [1 0 0 ]); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
313 %! assert (opts.linestyle, []); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
314 %! assert (opts.marker, []); |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
315 |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
316 ## Test input validation |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
317 %!error <argument must be a character string or cell array> __pltopt__ ("abc", 1) |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
318 %!error <unfinished key label> __pltopt__ ("abc", "rx;my_title", true) |
702aa79dc482
Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
319 %!error <unrecognized format character: 'u'> __pltopt__ ("abc", "u", true) |