annotate scripts/plot/util/__next_line_style__.m @ 27919:1891570abac8

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2020.
author John W. Eaton <jwe@octave.org>
date Mon, 06 Jan 2020 22:29:51 -0500
parents b442ec6dda5c
children bd51beb6205e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27919
1891570abac8 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27918
diff changeset
1 ## Copyright (C) 2010-2020 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
2 ##
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
3 ## See the file COPYRIGHT.md in the top-level directory of this distribution
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ## or <https://octave.org/COPYRIGHT.html/>.
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
5 ##
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
6 ##
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
7 ## This file is part of Octave.
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
8 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
9 ## Octave is free software: you can redistribute it and/or modify it
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
10 ## 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
11 ## 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
12 ## (at your option) any later version.
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
13 ##
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
14 ## Octave is distributed in the hope that it will be useful, but
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
15 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## GNU General Public License for more details.
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
18 ##
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
19 ## You should have received a copy of the GNU General Public License
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
20 ## 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
21 ## <https://www.gnu.org/licenses/>.
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
22
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
23 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
24 ## @deftypefn {} {@var{style} =} __next_line_style__ (@var{reset})
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
25 ## Undocumented internal function.
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
26 ## @end deftypefn
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
27
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
28 ## Return the next line style in the rotation.
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
29
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
30
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
31 function [linestyle, marker] = __next_line_style__ ()
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
32
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
33 ca = gca ();
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
34
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
35 styleorder = get (ca, "linestyleorder");
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
36 if (isempty (styleorder))
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
37 linestyle = "-"; # basic line
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
38 marker = "none"; # no marker
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
39 return;
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
40 endif
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
41
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
42 if (ischar (styleorder))
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
43 styleorder = cellstr (styleorder);
16943
0dab17e69a55 Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents: 16942
diff changeset
44 endif
0dab17e69a55 Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents: 16942
diff changeset
45
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
46 style_idx = fix (get (ca, "linestyleorderindex"));
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
47 num_styles = rows (styleorder);
22071
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
48 style_idx = mod (style_idx, num_styles);
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
49 if (style_idx == 0)
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
50 style_idx = num_styles;
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
51 elseif (style_idx < 0)
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
52 style_idx = 1;
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
53 endif
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
54
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
55 options = __pltopt__ ("__next_line_style__", styleorder{style_idx});
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
56 linestyle = options.linestyle;
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
57 marker = options.marker;
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
58
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
59 endfunction
17338
1c89599167a6 maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents: 17315
diff changeset
60
19171
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
61
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
62 %!test
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
63 %! hf = figure ("visible", "off");
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
64 %! unwind_protect
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
65 %! hax = axes ();
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
66 %! set (hax, "colororder", [0 0 1]);
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
67 %! set (hax, "linestyleorder", {"-", ":", "--"});
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
68 %! hold on;
22071
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
69 %! h = plot (1:2,1:2, 2:3,2:3, 3:4,3:4);
19171
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
70 %! assert (get (h, "linestyle"), {"-"; ":"; "--"});
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
71 %! cla (hax);
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
72 %! hold on;
22071
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
73 %! h1 = plot (1:2,1:2);
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
74 %! h2 = plot (2:3,2:3);
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
75 %! h3 = plot (3:4,3:4);
19171
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
76 %! assert (get ([h1;h2;h3], "linestyle"), {"-"; ":"; "--"});
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
77 %! unwind_protect_cleanup
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
78 %! close (hf);
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
79 %! end_unwind_protect