Mercurial > hg > octave-nkf
annotate scripts/plot/appearance/__getlegenddata__.m @ 20830:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19367
diff
changeset
|
1 ## Copyright (C) 2010-2015 David Bateman |
12339
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
2 ## |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
4 ## |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
8 ## your option) any later version. |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
9 ## |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
13 ## General Public License for more details. |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
14 ## |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
18 |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
19344
0f9c5a15c8fa
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
18792
diff
changeset
|
20 ## @deftypefn {Function File} {[@var{hplots}, @var{strings}] =} __getlegenddata__ (@var{h}) |
12339
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
21 ## Undocumented internal function. |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
22 ## @end deftypefn |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
23 |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
24 function [hplots, text_strings] = __getlegenddata__ (hlegend) |
17539
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
25 |
12339
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
26 hplots = []; |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
27 text_strings = {}; |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
28 ca = getfield (get (hlegend, "userdata"), "handle"); |
17539
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
29 if (numel (ca) == 1) |
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
30 kids = get (ca, "children"); |
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
31 else |
18792
8c0646dd9e5a
legend.m: Fix bug updating plotyy figures (bug #41970).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
32 kids = [get(ca, "children"){:}]; |
17539
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
33 endif |
13232
9b98affe52b9
__getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents:
12764
diff
changeset
|
34 |
9b98affe52b9
__getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents:
12764
diff
changeset
|
35 for i = numel (kids):-1:1 |
9b98affe52b9
__getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents:
12764
diff
changeset
|
36 typ = get (kids(i), "type"); |
17539
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
37 if (any (strcmp (typ, {"line", "patch", "surface", "hggroup"}))) |
13232
9b98affe52b9
__getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents:
12764
diff
changeset
|
38 if (strcmp (typ, "hggroup")) |
9b98affe52b9
__getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents:
12764
diff
changeset
|
39 hgkids = get (kids(i), "children"); |
12339
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
40 for j = 1 : length (hgkids) |
17539
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
41 try |
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
42 dname = get (hgkids(j), "DisplayName"); |
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
43 if (! isempty (dname)) |
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
44 hplots(end+1) = hgkids(j); |
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
45 text_strings(end+1) = dname; |
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
46 break; # break from j-loop over hgkids |
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
47 endif |
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
48 end_try_catch |
12339
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
49 endfor |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
50 else |
17539
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
51 dname = get (kids(i), "DisplayName"); |
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
52 if (! isempty (dname)) |
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
53 hplots(end+1) = kids(i); |
485aeffc0c22
__getlegenddata__.m: Recode for better performance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
54 text_strings(end+1) = dname; |
12339
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
55 endif |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
56 endif |
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
57 endif |
13232
9b98affe52b9
__getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents:
12764
diff
changeset
|
58 endfor |
9b98affe52b9
__getlegenddata__.m: Fix bad subscript index error (Bug #33774).
Rik <octave@nomad.inbox5.com>
parents:
12764
diff
changeset
|
59 |
12339
eda5eabd5d0b
Fix for inline legends (#32022, #32343)
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
60 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
61 |
19367
cd554c5b65ee
Mark __clabel__ and __getlegenddata__ as internal functions not requiring BIST.
Rik <rik@octave.org>
parents:
19344
diff
changeset
|
62 |
cd554c5b65ee
Mark __clabel__ and __getlegenddata__ as internal functions not requiring BIST.
Rik <rik@octave.org>
parents:
19344
diff
changeset
|
63 ## No test needed for internal helper function. |
cd554c5b65ee
Mark __clabel__ and __getlegenddata__ as internal functions not requiring BIST.
Rik <rik@octave.org>
parents:
19344
diff
changeset
|
64 %!assert (1) |
cd554c5b65ee
Mark __clabel__ and __getlegenddata__ as internal functions not requiring BIST.
Rik <rik@octave.org>
parents:
19344
diff
changeset
|
65 |