Mercurial > hg > octave-nkf
annotate scripts/plot/util/__next_line_style__.m @ 18479:0f32b34f6ec0 stable
figure.m: Don't make figure N visible when property explicitly set to 'off' (bug #41396)
* scripts/plot/util/figure.m: Don't make figure N visible when property explicitly set to 'off'
Add test to re-activate existing figure with 'visible' set to 'off'
author | Markus Appel <masolomaster3000@googlemail.com> |
---|---|
date | Wed, 29 Jan 2014 21:26:13 +0100 |
parents | d63878346099 |
children | 702aa79dc482 |
rev | line source |
---|---|
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17572
diff
changeset
|
1 ## Copyright (C) 2010-2013 David Bateman |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
2 ## |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
3 ## 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
|
4 ## |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
8 ## your option) any later version. |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
9 ## |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
10 ## 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
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
13 ## General Public License for more details. |
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 ## 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
|
16 ## along with Octave; see the file COPYING. If not, see |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
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 ## -*- texinfo -*- |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
20 ## @deftypefn {Function File} {@var{style} =} __next_line_style__ (@var{reset}) |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
21 ## Undocumented internal function. |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
22 ## @end deftypefn |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
23 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
24 ## 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
|
25 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
26 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
27 function [linestyle, marker] = __next_line_style__ (reset) |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
28 |
16942
78a2f43bbc69
Implemented line color and style rotation across multiple axes (bug #39344).
costerwisch@costerwisch-lt1
parents:
16724
diff
changeset
|
29 persistent reset_style = true; |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
30 |
16943
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
31 if (nargin == 1) |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
32 ## Indicates whether the next call will increment or not |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
33 reset_style = reset; |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
34 else |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
35 ## Find and return the next line style |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
36 ca = gca (); |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
37 style_rotation = get (ca, "linestyleorder"); |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
38 if (ischar (style_rotation)) |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
39 style_rotation = strsplit (style_rotation, "|"); |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
40 endif |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
41 nStyles = length (style_rotation); |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
42 if (reset_style || (nStyles < 2)) |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
43 style_index = 1; |
16959
22ec459cf7ba
Correction to allow multi-line plots to have multiple colors (bug #16955).
Carl Osterwisch <costerwisch@generalcompression.com>
parents:
16943
diff
changeset
|
44 reset_style = false; |
16943
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
45 else |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
46 ## Executed when "hold all" is active |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
47 nChildren = length (get (ca, "Children")); |
17315
3abed16370ad
Fix LineStyleOrder cycling when ColorOrder is a single value (bug #39854)
Stefan Mahr <dac922@gmx.de>
parents:
17176
diff
changeset
|
48 nColors = rows (get (ca, "ColorOrder")); |
16943
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
49 style_index = mod (floor (nChildren/nColors), nStyles) + 1; |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
50 endif |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
51 options = __pltopt__ ("__next_line_style__", |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
52 style_rotation(style_index)); |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
53 linestyle = options.linestyle; |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
54 marker = options.marker; |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
55 endif |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
56 |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
57 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17315
diff
changeset
|
58 |