annotate scripts/plot/util/__next_line_style__.m @ 30564:796f54d4ddbf stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021. In all .txi and .texi files except gpl.txi and gpl.texi in the doc/liboctave and doc/interpreter directories, change the copyright to "Octave Project Developers", the same as used for other source files. Update copyright notices for 2022 (not done since 2019). For gpl.txi and gpl.texi, change the copyright notice to be "Free Software Foundation, Inc." and leave the date at 2007 only because this file only contains the text of the GPL, not anything created by the Octave Project Developers. Add Paul Thomas to contributors.in.
author John W. Eaton <jwe@octave.org>
date Tue, 28 Dec 2021 18:22:40 -0500
parents 0a5b15007766
children 597f3ee61a48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
3 ## Copyright (C) 2010-2022 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
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
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: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
7 ##
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
8 ## 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
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
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
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.
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
14 ##
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
15 ## 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
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.
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
19 ##
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
20 ## 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
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/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
25
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
27 ## @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
28 ## Undocumented internal function.
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
29 ## @end deftypefn
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
30
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
31 ## 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
32
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
33
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
34 function [linestyle, marker] = __next_line_style__ ()
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
35
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
36 ca = gca ();
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
37
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
38 styleorder = get (ca, "linestyleorder");
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
39 if (isempty (styleorder))
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
40 linestyle = "-"; # basic line
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
41 marker = "none"; # no marker
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
42 return;
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
43 endif
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
44
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
45 if (ischar (styleorder))
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
46 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
47 endif
0dab17e69a55 Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents: 16942
diff changeset
48
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
49 style_idx = fix (get (ca, "linestyleorderindex"));
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
50 num_styles = rows (styleorder);
22071
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
51 style_idx = mod (style_idx, num_styles);
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
52 if (style_idx == 0)
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
53 style_idx = num_styles;
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
54 elseif (style_idx < 0)
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
55 style_idx = 1;
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
56 endif
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
57
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
58 options = __pltopt__ ("__next_line_style__", styleorder{style_idx});
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
59 linestyle = options.linestyle;
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
60 marker = options.marker;
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
61
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff changeset
62 endfunction
17338
1c89599167a6 maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents: 17315
diff changeset
63
19171
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
64
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
65 %!test
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
66 %! hf = figure ("visible", "off");
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
67 %! unwind_protect
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
68 %! hax = axes ();
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
69 %! set (hax, "colororder", [0 0 1]);
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
70 %! set (hax, "linestyleorder", {"-", ":", "--"});
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
71 %! hold on;
22071
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
72 %! 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
73 %! assert (get (h, "linestyle"), {"-"; ":"; "--"});
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
74 %! cla (hax);
22069
9121d6584f6a Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents: 20852
diff changeset
75 %! hold on;
22071
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
76 %! h1 = plot (1:2,1:2);
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
77 %! h2 = plot (2:3,2:3);
7ac3dd72fff9 Fix failing BIST test from cset 9121d6584f6a.
Rik <rik@octave.org>
parents: 22069
diff changeset
78 %! 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
79 %! assert (get ([h1;h2;h3], "linestyle"), {"-"; ":"; "--"});
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
80 %! unwind_protect_cleanup
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
81 %! close (hf);
702aa79dc482 Add BIST tests for various quasi-internal m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
82 %! end_unwind_protect