Mercurial > hg > octave-lyh
annotate scripts/plot/private/__errplot__.m @ 17481:576cf0589c6d
Overhaul contour labeling functions.
* scripts/plot/clabel.m: Use 'h', rather than 'retval', to match variables to
documentation. Improve performance of input processing by using try/catch block
and eliminating for loops.
* scripts/plot/private/__clabel__.m: Get X and Y spacing in points from axis
rather than assuming 4"x3" plot figure. Fix incorrect determination of axis limits
if no contour handle provided. Rename loop vars i1, j1 to i,j. Performance
improvement by using bsxfun over repmat. Use find to replace while loop (slow).
Keep label rotation in the range [-90, 90] for readability.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 24 Sep 2013 13:16:50 -0700 |
parents | 4a6a4657fdf2 |
children |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13221
diff
changeset
|
1 ## Copyright (C) 2000-2012 Teemu Ikonen |
3718 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
3718 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
3718 | 18 |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8506
diff
changeset
|
19 ## -*- texinfo -*- |
17184
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
17129
diff
changeset
|
20 ## @deftypefn {Function File} {@var{h} =} __errplot__ (@var{fstr}, @var{hax}, @dots{}) |
6895 | 21 ## Undocumented internal function. |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8506
diff
changeset
|
22 ## @end deftypefn |
5720 | 23 |
3718 | 24 ## Created: 18.7.2000 |
25 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> | |
26 ## Keywords: errorbar, plotting | |
27 | |
17184
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
17129
diff
changeset
|
28 function h = __errplot__ (fstr, hax, varargin) |
4007 | 29 |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
30 fmt = __pltopt__ ("__errplot__", fstr); |
4007 | 31 |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
32 ## Set the plot type based on linestyle. |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
33 switch (fmt.errorstyle) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
34 case "~" |
6736 | 35 ifmt = "yerr"; |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
36 case ">" |
6736 | 37 ifmt = "xerr"; |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
38 case "~>" |
6736 | 39 ifmt = "xyerr"; |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
40 case "#" |
6736 | 41 ifmt = "box"; |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
42 case "#~" |
6736 | 43 ifmt = "boxy"; |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
44 case "#~>" |
6736 | 45 ifmt = "boxxy"; |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
46 otherwise |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
47 ifmt = "yerr"; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
48 endswitch |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
49 |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
50 h = []; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
51 nplots = columns (varargin{1}); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
52 for i = 1:nplots |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
53 |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
54 if (isempty (fmt.color)) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
55 lc = __next_line_color__ (); |
6736 | 56 else |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
57 lc = fmt.color (); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
58 endif |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
59 if (isempty (fmt.marker) && isempty (fmt.linestyle)) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
60 [ls, mk] = __next_line_style__ (); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
61 else |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
62 ls = fmt.linestyle; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
63 mk = fmt.marker; |
10576
384c514bbae2
Allow setting of the markers in errorbar linestyles
David Bateman <dbateman@free.fr>
parents:
10575
diff
changeset
|
64 endif |
384c514bbae2
Allow setting of the markers in errorbar linestyles
David Bateman <dbateman@free.fr>
parents:
10575
diff
changeset
|
65 |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
66 ## Must occur after __next_line_color__ in order to work correctly. |
17184
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
17129
diff
changeset
|
67 hg = hggroup ("parent", hax); |
8258 | 68 h = [h; hg]; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
69 args = __add_datasource__ ("__errplot__", hg, |
10549 | 70 {"x", "y", "l", "u", "xl", "xu"}); |
8258 | 71 |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
72 hl = [(__line__ (hg, "color", lc, "linestyle", ls, "marker", mk)), |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
73 (__line__ (hg, "color", lc, "linestyle", "-", "marker", "none"))]; |
6736 | 74 |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
75 switch (numel (varargin)) |
4897 | 76 case 2 |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
77 ydata = varargin{1}(:,i); |
13221
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
78 xdata = 1:numel (ydata); |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
79 if (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy")) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
80 ldata = varargin{2}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
81 udata = ldata; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
82 xldata = []; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
83 xudata = []; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
84 elseif (strcmp (ifmt, "xerr") || strcmp (ifmt, "box")) |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
85 xldata = varargin{2}(:,i); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
86 xudata = ldata; |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
87 ldata = []; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
88 udata = []; |
10573
d8894a2d0a03
Allow x, xy and box errorbars with different plotting syntax
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
89 else |
13221
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
90 error ("errorbar: 2 column errorplot is only valid for xerr or yerr"); |
10573
d8894a2d0a03
Allow x, xy and box errorbars with different plotting syntax
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
91 endif |
4897 | 92 case 3 |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
93 if (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy")) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
94 xdata = varargin{1}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
95 ydata = varargin{2}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
96 ldata = varargin{3}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
97 udata = ldata; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
98 xldata = []; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
99 xudata = []; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
100 elseif (strcmp (ifmt, "xyerr") || strcmp (ifmt, "boxxy")) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
101 ydata = varargin{1}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
102 xdata = 1:numel (ydata); |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
103 xldata = varargin{2}(:,i); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
104 xudata = xldata; |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
105 ldata = varargin{3}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
106 udata = ldata; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
107 else # xerr or box |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
108 xdata = varargin{1}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
109 ydata = varargin{2}(:,i); |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
110 xldata = varargin{3}(:,i); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
111 xudata = xldata; |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
112 ldata = []; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
113 udata = []; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
114 endif |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
115 case 4 |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
116 if (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy")) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
117 xdata = varargin{1}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
118 ydata = varargin{2}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
119 ldata = varargin{3}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
120 udata = varargin{4}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
121 xldata = []; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
122 xudata = []; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
123 elseif (strcmp (ifmt, "xyerr") || strcmp (ifmt, "boxxy")) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
124 xdata = varargin{1}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
125 ydata = varargin{2}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
126 xldata = varargin{3}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
127 xudata = xldata; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
128 ldata = varargin{4}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
129 udata = ldata; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
130 else # xerr or box |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
131 xdata = varargin{1}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
132 ydata = varargin{2}(:,i); |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
133 xldata = varargin{3}(:,i); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
134 xudata = varargin{4}(:,i); |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
135 ldata = []; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
136 udata = []; |
10549 | 137 endif |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
138 case 6 # xyerr, boxxy |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
139 if (strcmp (ifmt, "xyerr") || strcmp (ifmt, "boxxy")) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
140 xdata = varargin{1}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
141 ydata = varargin{2}(:,i); |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
142 xldata = varargin{3}(:,i); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
143 xudata = varargin{4}(:,i); |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
144 ldata = varargin{5}(:,i); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
145 udata = varargin{6}(:,i); |
10573
d8894a2d0a03
Allow x, xy and box errorbars with different plotting syntax
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
146 else |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
147 error ("errorbar: error plot with 6 columns only valid for xyerr and boxxy"); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
148 endif |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
149 otherwise |
13221
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
150 error ("errorbar: error plot requires 2, 3, 4, or 6 arguments"); |
4897 | 151 endswitch |
8258 | 152 |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
153 addproperty ("xdata", hg, "data", xdata(:)); |
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
154 addproperty ("ydata", hg, "data", ydata(:)); |
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
155 addproperty ("ldata", hg, "data", ldata(:)); |
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
156 addproperty ("udata", hg, "data", udata(:)); |
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
157 addproperty ("xldata", hg, "data", xldata(:)); |
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
158 addproperty ("xudata", hg, "data", xudata(:)); |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
159 addproperty ("format", hg, "string", ifmt); |
10587
eb69d94e8648
Update the errorbar markers in a seperate listtener function
David Bateman <dbateman@free.fr>
parents:
10584
diff
changeset
|
160 |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
161 addproperty ("color", hg, "linecolor", get (hl(1), "color")); |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
162 addproperty ("linestyle", hg, "linelinestyle", get (hl(1), "linestyle")); |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
163 addproperty ("linewidth", hg, "linelinewidth", get (hl(1), "linewidth")); |
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
164 addproperty ("marker", hg, "linemarker", get (hl(1), "marker")); |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
165 addproperty ("markeredgecolor", hg, "linemarkerfacecolor", |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
166 get (hl(1), "markeredgecolor")); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
167 addproperty ("markerfacecolor", hg, "linemarkerfacecolor", |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
168 get (hl(1), "markerfacecolor")); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
169 addproperty ("markersize", hg, "linemarkersize", |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
170 get (hl(1), "markersize")); |
8258 | 171 |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
172 fcn = {@update_props, hl}; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
173 addlistener (hg, "color", fcn); |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
174 addlistener (hg, "linestyle", fcn); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
175 addlistener (hg, "linewidth", fcn); |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
176 addlistener (hg, "marker", fcn); |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
177 addlistener (hg, "markeredgecolor", fcn); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
178 addlistener (hg, "markerfacecolor", fcn); |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
179 addlistener (hg, "markersize", fcn); |
8258 | 180 |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
181 fcn = {@update_data, hl}; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
182 addlistener (hg, "xdata", fcn); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
183 addlistener (hg, "ydata", fcn); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
184 addlistener (hg, "ldata", fcn); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
185 addlistener (hg, "udata", fcn); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
186 addlistener (hg, "xldata", fcn); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
187 addlistener (hg, "xudata", fcn); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
188 addlistener (hg, "format", fcn); |
8258 | 189 |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
190 hax = ancestor (hg, "axes"); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
191 addlistener (hax, "xscale", fcn); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
192 addlistener (hax, "yscale", fcn); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
193 |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
194 update_data (hg, [], hl); |
8258 | 195 |
5406 | 196 endfor |
197 | |
13221
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
198 ## Process legend key |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
199 if (! isempty (fmt.key)) |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
200 hlegend = []; |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14552
diff
changeset
|
201 fkids = get (gcf (), "children"); |
13221
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
202 for i = 1 : numel (fkids) |
17129
b5d6314314fc
Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
203 if ( strcmp (get (fkids(i), "type"), "axes") |
b5d6314314fc
Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
204 && strcmp (get (fkids(i), "tag"), "legend")) |
13221
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
205 udata = get (fkids(i), "userdata"); |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
206 if (! isempty (intersect (udata.handle, gca ()))) |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
207 hlegend = fkids (i); |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
208 break; |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
209 endif |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
210 endif |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
211 endfor |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
212 |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
213 if (isempty (hlegend)) |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
214 hlgnd = []; |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
215 tlgnd = {}; |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
216 else |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
217 [hlgnd, tlgnd] = __getlegenddata__ (hlegend); |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
218 endif |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
219 |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
220 hlgnd(end+1) = hg; |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
221 tlgnd(end+1) = fmt.key; |
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
222 |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14552
diff
changeset
|
223 legend (gca (), hlgnd, tlgnd); |
14552
86854d032a37
maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
224 endif |
13221
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
225 |
4007 | 226 endfunction |
8258 | 227 |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
228 function [xdata, ydata] = errorbar_data (xdata, ydata, ldata, udata, |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
229 xldata, xudata, ifmt, |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
230 xscale, yscale) |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
231 if (strcmp (xscale, "linear")) |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
232 dx = 0.01 * (max (xdata(:)) - min (xdata(:))); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
233 xlo = xdata - dx; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
234 xhi = xdata + dx; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
235 else |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
236 n = xdata > 0; |
17312
4c7ee36f591d
__errplot__.m: Fix bug with loglogerr and negative y values (bug #39837).
Rik <rik@octave.org>
parents:
17184
diff
changeset
|
237 if (! any (n)) |
4c7ee36f591d
__errplot__.m: Fix bug with loglogerr and negative y values (bug #39837).
Rik <rik@octave.org>
parents:
17184
diff
changeset
|
238 n = xdata < 0; |
4c7ee36f591d
__errplot__.m: Fix bug with loglogerr and negative y values (bug #39837).
Rik <rik@octave.org>
parents:
17184
diff
changeset
|
239 endif |
4c7ee36f591d
__errplot__.m: Fix bug with loglogerr and negative y values (bug #39837).
Rik <rik@octave.org>
parents:
17184
diff
changeset
|
240 logdata = log (abs (xdata(n))); |
4c7ee36f591d
__errplot__.m: Fix bug with loglogerr and negative y values (bug #39837).
Rik <rik@octave.org>
parents:
17184
diff
changeset
|
241 rx = exp (0.01 * (max (logdata) - min (logdata))); |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
242 xlo = xdata/rx; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
243 xhi = xdata*rx; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
244 endif |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
245 if (strcmp (yscale, "linear")) |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
246 dy = 0.01 * (max (ydata(:)) - min (ydata(:))); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
247 ylo = ydata - dy; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
248 yhi = ydata + dy; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
249 else |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
250 n = ydata > 0; |
17312
4c7ee36f591d
__errplot__.m: Fix bug with loglogerr and negative y values (bug #39837).
Rik <rik@octave.org>
parents:
17184
diff
changeset
|
251 if (! any (n)) |
4c7ee36f591d
__errplot__.m: Fix bug with loglogerr and negative y values (bug #39837).
Rik <rik@octave.org>
parents:
17184
diff
changeset
|
252 n = ydata < 0; |
4c7ee36f591d
__errplot__.m: Fix bug with loglogerr and negative y values (bug #39837).
Rik <rik@octave.org>
parents:
17184
diff
changeset
|
253 endif |
4c7ee36f591d
__errplot__.m: Fix bug with loglogerr and negative y values (bug #39837).
Rik <rik@octave.org>
parents:
17184
diff
changeset
|
254 logdata = log (abs (ydata(n))); |
4c7ee36f591d
__errplot__.m: Fix bug with loglogerr and negative y values (bug #39837).
Rik <rik@octave.org>
parents:
17184
diff
changeset
|
255 ry = exp (0.01 * (max (logdata) - min (logdata))); |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
256 ylo = ydata/ry; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
257 yhi = ydata*ry; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
258 endif |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
259 nans = NaN + xdata(:); # fast way to do NaN (size (xdata(:))) |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
260 if (strcmp (ifmt, "yerr")) |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
261 xdata = [xdata, xdata, nans, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
262 xlo, xhi, nans, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
263 xlo, xhi, nans]; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
264 ydata = [ydata-ldata, ydata+udata, nans, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
265 ydata+udata, ydata+udata, nans, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
266 ydata-ldata, ydata-ldata, nans]; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
267 elseif (strcmp (ifmt, "xerr")) |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
268 xdata = [xdata-xldata, xdata+xudata, nans, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
269 xdata+xudata, xdata+xudata, nans, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
270 xdata-xldata, xdata-xldata, nans]; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
271 ydata = [ydata, ydata, nans, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
272 ylo, yhi, nans, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
273 ylo, yhi, nans]; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
274 elseif (strcmp (ifmt, "boxy")) |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
275 dx = 0.01 * (max (xdata(:)) - min (xdata(:))); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
276 xdata = [xlo, xhi, xhi, xlo, xlo, nans]; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
277 ydata = [ydata-ldata, ydata-ldata, ydata+udata, ydata+udata, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
278 ydata-ldata, nans]; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
279 elseif (strcmp (ifmt, "box")) |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
280 dy = 0.01 * (max (ydata(:)) - min (ydata(:))); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
281 xdata = [xdata-xldata, xdata+xudata, xdata+xudata, xdata-xldata, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
282 xdata-xldata, nans]; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
283 ydata = [ylo, ylo, yhi, yhi, ylo, nans]; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
284 elseif (strcmp (ifmt, "boxxy")) |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
285 xdata = [xdata-xldata, xdata+xudata, xdata+xudata, xdata-xldata, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
286 xdata-xldata, nans]; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
287 ydata = [ydata-ldata, ydata-ldata, ydata+udata, ydata+udata, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
288 ydata-ldata, nans]; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
289 elseif (strcmp (ifmt, "xyerr")) |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
290 [x1, y1] = errorbar_data (xdata, ydata, ldata, udata, |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
291 xldata, xudata, "xerr", xscale, yscale); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
292 [x2, y2] = errorbar_data (xdata, ydata, ldata, udata, |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
293 xldata, xudata, "yerr", xscale, yscale); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
294 xdata = [x1; x2]; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
295 ydata = [y1; y2]; |
17320
088d014a7fe2
Use semicolon after "return" statement in core m-files.
Rik <rik@octave.org>
parents:
17312
diff
changeset
|
296 return; |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
297 else |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
298 error ("errorbar: valid error bar types are xerr, yerr, xyerr, box, boxy, boxxy"); |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
299 endif |
13221
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
300 |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
301 xdata = xdata.'(:); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
302 ydata = ydata.'(:); |
13221
cc6e9425c04e
errorbar plots can now accept a legend key (Bug #33580).
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
303 |
8258 | 304 endfunction |
305 | |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
306 function update_props (hg, ~, hl) |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
307 set (hl, "color", get (hg, "color"), |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
308 "linewidth", get (hg, "linewidth")); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
309 set (hl(1), "linestyle", get (hg, "linestyle"), |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
310 "marker", get (hg, "marker"), |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
311 "markeredgecolor", get (hg, "markeredgecolor"), |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
312 "markerfacecolor", get (hg, "markerfacecolor"), |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
313 "markersize", get (hg, "markersize")); |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
314 endfunction |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
315 |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
316 function update_data (hg, ~, hl) |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
317 |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
318 if (strcmp (get (hg, "type"), "axes")) |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
319 hax = hg; |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
320 hg = ancestor (hl(1), "hggroup"); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
321 else |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
322 hax = ancestor (hg, "axes"); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
323 endif |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
324 xscale = get (hax, "xscale"); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
325 yscale = get (hax, "yscale"); |
8258 | 326 |
17443
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
327 xdata = get (hg, "xdata"); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
328 ydata = get (hg, "ydata"); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
329 ldata = get (hg, "ldata"); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17320
diff
changeset
|
330 udata = get (hg, "udata"); |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
331 xldata = get (hg, "xldata"); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
332 xudata = get (hg, "xudata"); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
333 ifmt = get (hg, "format"); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
334 |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
335 set (hl(1), "xdata", xdata); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
336 set (hl(1), "ydata", ydata); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
337 |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
338 [errorbar_xdata, errorbar_ydata] = ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
339 errorbar_data (xdata, ydata, ldata, udata, xldata, xudata, ... |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
340 ifmt, xscale, yscale); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
341 |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
342 set (hl(2), "xdata", errorbar_xdata); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
343 set (hl(2), "ydata", errorbar_ydata); |
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
344 |
8258 | 345 endfunction |
10592
f0a7a72c1fbf
__errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents:
10590
diff
changeset
|
346 |