Mercurial > octave-nkf
annotate scripts/plot/private/__next_line_color__.m @ 17436:47269b03a946
__next_line_color__.m: Remove use of CamelCase.
* scripts/plot/private/__next_line_color__.m: Remove use of CamelCase.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 18 Sep 2013 17:11:32 -0700 |
parents | abf384f5d243 |
children |
rev | line source |
---|---|
16943
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
1 ## Copyright (C) 2013 Carl Osterwisch |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
12793
diff
changeset
|
2 ## Copyright (C) 2007-2012 John W. Eaton |
6264 | 3 ## |
4 ## This file is part of Octave. | |
5 ## | |
6 ## Octave is free software; you can redistribute it and/or modify it | |
7 ## under the terms of the GNU General Public License as published by | |
7016 | 8 ## the Free Software Foundation; either version 3 of the License, or (at |
9 ## your option) any later version. | |
6264 | 10 ## |
11 ## Octave is distributed in the hope that it will be useful, but | |
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 ## General Public License for more details. | |
15 ## | |
16 ## You should have received a copy of the GNU General Public License | |
7016 | 17 ## along with Octave; see the file COPYING. If not, see |
18 ## <http://www.gnu.org/licenses/>. | |
6264 | 19 |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
7016
diff
changeset
|
20 ## -*- texinfo -*- |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
7016
diff
changeset
|
21 ## @deftypefn {Function File} {@var{rgb} =} __next_line_color__ (@var{reset}) |
6895 | 22 ## Undocumented internal function. |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
7016
diff
changeset
|
23 ## @end deftypefn |
6895 | 24 |
6264 | 25 ## Return the next line color in the rotation. |
26 | |
16942
78a2f43bbc69
Implemented line color and style rotation across multiple axes (bug #39344).
costerwisch@costerwisch-lt1
parents:
14138
diff
changeset
|
27 ## Author: Carl Osterwisch |
16943
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
28 ## Author: jwe |
6264 | 29 |
30 function rgb = __next_line_color__ (reset) | |
31 | |
16942
78a2f43bbc69
Implemented line color and style rotation across multiple axes (bug #39344).
costerwisch@costerwisch-lt1
parents:
14138
diff
changeset
|
32 persistent reset_colors = true; |
6264 | 33 |
16943
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
34 if (nargin == 1) |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
35 ## 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
|
36 reset_colors = reset; |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
37 else |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
38 ## Find and return the next line color |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
39 ca = gca (); |
17436
47269b03a946
__next_line_color__.m: Remove use of CamelCase.
Rik <rik@octave.org>
parents:
17176
diff
changeset
|
40 colororder = 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
|
41 if (reset_colors) |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
42 color_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
|
43 reset_colors = false; |
16943
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
44 else |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
45 ## Executed when "hold all" is active |
17436
47269b03a946
__next_line_color__.m: Remove use of CamelCase.
Rik <rik@octave.org>
parents:
17176
diff
changeset
|
46 n_kids = length (get (ca, "children")); |
47269b03a946
__next_line_color__.m: Remove use of CamelCase.
Rik <rik@octave.org>
parents:
17176
diff
changeset
|
47 n_colors = rows (colororder); |
47269b03a946
__next_line_color__.m: Remove use of CamelCase.
Rik <rik@octave.org>
parents:
17176
diff
changeset
|
48 color_index = mod (n_kids, n_colors) + 1; |
16943
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
49 endif |
17436
47269b03a946
__next_line_color__.m: Remove use of CamelCase.
Rik <rik@octave.org>
parents:
17176
diff
changeset
|
50 rgb = colororder(color_index,:); |
16943
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
51 endif |
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
52 |
6264 | 53 endfunction |
16943
0dab17e69a55
Implement line color and style rotation across multiple axes (bug #39344).
Carl Osterwisch <costerwisch@costerwisch-lt1>
parents:
16942
diff
changeset
|
54 |