Mercurial > octave
annotate scripts/plot/util/__next_line_style__.m @ 31212:55415fa6a20f
svgconvert: Use Lossless encoding of images when available (bug #52193)
* acinclude.m4: Check that QPainter::LosslessImageRendering flag is available.
* octave-svgconvert.cc (draw): Use new flag if available.
* print.m (doc): Update word of caution about svgconvert and images.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Mon, 29 Aug 2022 16:36:34 +0200 |
parents | 796f54d4ddbf |
children | 597f3ee61a48 |
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 |