annotate scripts/plot/private/__errplot__.m @ 11099:65b240770880

Fix normal line and marker types for errorplots.
author Ben Abbott <bpabbott@mac.com>
date Sat, 16 Oct 2010 14:38:57 +0400
parents d1978e7364ad
children 36c18286a61b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8920
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8812
diff changeset
1 ## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
2 ## Teemu Ikonen
3718
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
3 ##
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
4 ## This file is part of Octave.
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
5 ##
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
6 ## Octave is free software; you can redistribute it and/or modify it
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
7 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
8 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
9 ## your option) any later version.
3718
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
10 ##
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
11 ## Octave is distributed in the hope that it will be useful, but
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
14 ## General Public License for more details.
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
15 ##
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
16 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
17 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
18 ## <http://www.gnu.org/licenses/>.
3718
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
19
8812
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8506
diff changeset
20 ## -*- texinfo -*-
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8506
diff changeset
21 ## @deftypefn {Function File} {@var{h} =} __errplot__ (@var{fstr}, @var{p}, @dots{})
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6736
diff changeset
22 ## Undocumented internal function.
8812
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8506
diff changeset
23 ## @end deftypefn
5720
067948dc39bf [project @ 2006-03-28 11:25:29 by jwe]
jwe
parents: 5642
diff changeset
24
3718
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
25 ## Created: 18.7.2000
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
26 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
27 ## Keywords: errorbar, plotting
65c6da68ddb3 [project @ 2000-09-08 06:50:02 by jwe]
jwe
parents:
diff changeset
28
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
29 function h = __errplot__ (fstr, p, varargin)
5406
c49aec8a9080 [project @ 2005-07-08 15:25:43 by jwe]
jwe
parents: 5395
diff changeset
30
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6203
diff changeset
31 if (nargin < 4 || nargin > 8) # at least two data arguments needed
6046
34f96dd5441b [project @ 2006-10-10 16:10:25 by jwe]
jwe
parents: 6004
diff changeset
32 print_usage ();
4897
89eee52fd4c7 [project @ 2004-06-03 23:07:55 by jwe]
jwe
parents: 4717
diff changeset
33 endif
4007
31448e09d38e [project @ 2002-07-26 01:47:32 by jwe]
jwe
parents: 4006
diff changeset
34
8259
dad9a322c639 Remove debugging from previous patch
David Bateman <dbateman@free.fr>
parents: 8258
diff changeset
35 [fmt, key] = __pltopt__ ("__errplot__", fstr);
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6046
diff changeset
36
11099
65b240770880 Fix normal line and marker types for errorplots.
Ben Abbott <bpabbott@mac.com>
parents: 10635
diff changeset
37 fmt
65b240770880 Fix normal line and marker types for errorplots.
Ben Abbott <bpabbott@mac.com>
parents: 10635
diff changeset
38
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
39 [len, nplots] = size (varargin{1});
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
40 h = [];
4007
31448e09d38e [project @ 2002-07-26 01:47:32 by jwe]
jwe
parents: 4006
diff changeset
41
4897
89eee52fd4c7 [project @ 2004-06-03 23:07:55 by jwe]
jwe
parents: 4717
diff changeset
42 for i = 1:nplots
6736
751f340d486c [project @ 2007-06-15 21:31:38 by jwe]
jwe
parents: 6448
diff changeset
43 ## Set the plot type based on linestyle.
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
44
10580
1479b93ee655 Respect linestyleorder in errorbar plots
David Bateman <dbateman@free.fr>
parents: 10576
diff changeset
45 if (strcmp (fmt.errorstyle, "~"))
6736
751f340d486c [project @ 2007-06-15 21:31:38 by jwe]
jwe
parents: 6448
diff changeset
46 ifmt = "yerr";
10580
1479b93ee655 Respect linestyleorder in errorbar plots
David Bateman <dbateman@free.fr>
parents: 10576
diff changeset
47 elseif (strcmp (fmt.errorstyle, ">"))
6736
751f340d486c [project @ 2007-06-15 21:31:38 by jwe]
jwe
parents: 6448
diff changeset
48 ifmt = "xerr";
10580
1479b93ee655 Respect linestyleorder in errorbar plots
David Bateman <dbateman@free.fr>
parents: 10576
diff changeset
49 elseif (strcmp (fmt.errorstyle, "~>"))
6736
751f340d486c [project @ 2007-06-15 21:31:38 by jwe]
jwe
parents: 6448
diff changeset
50 ifmt = "xyerr";
10580
1479b93ee655 Respect linestyleorder in errorbar plots
David Bateman <dbateman@free.fr>
parents: 10576
diff changeset
51 elseif (strcmp (fmt.errorstyle, "#"))
6736
751f340d486c [project @ 2007-06-15 21:31:38 by jwe]
jwe
parents: 6448
diff changeset
52 ifmt = "box";
10580
1479b93ee655 Respect linestyleorder in errorbar plots
David Bateman <dbateman@free.fr>
parents: 10576
diff changeset
53 elseif (strcmp (fmt.errorstyle, "#~"))
6736
751f340d486c [project @ 2007-06-15 21:31:38 by jwe]
jwe
parents: 6448
diff changeset
54 ifmt = "boxy";
10590
083e4f6143fe __errplot__.m: Fix bug for boxxy errorbar.
Ben Abbott <bpabbott@mac.com>
parents: 10587
diff changeset
55 elseif (strcmp (fmt.errorstyle, "#~>"))
6736
751f340d486c [project @ 2007-06-15 21:31:38 by jwe]
jwe
parents: 6448
diff changeset
56 ifmt = "boxxy";
751f340d486c [project @ 2007-06-15 21:31:38 by jwe]
jwe
parents: 6448
diff changeset
57 else
11099
65b240770880 Fix normal line and marker types for errorplots.
Ben Abbott <bpabbott@mac.com>
parents: 10635
diff changeset
58 ifmt = "yerr";
10576
384c514bbae2 Allow setting of the markers in errorbar linestyles
David Bateman <dbateman@free.fr>
parents: 10575
diff changeset
59 endif
384c514bbae2 Allow setting of the markers in errorbar linestyles
David Bateman <dbateman@free.fr>
parents: 10575
diff changeset
60
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
61 hg = hggroup ("parent", p);
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
62 h = [h; hg];
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
63 args = __add_datasource__ ("__errplot__", hg,
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9896
diff changeset
64 {"x", "y", "l", "u", "xl", "xu"});
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
65
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
66 if (isempty (fmt.color))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
67 fmt.color = __next_line_color__ ();
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
68 endif
10580
1479b93ee655 Respect linestyleorder in errorbar plots
David Bateman <dbateman@free.fr>
parents: 10576
diff changeset
69 if (isempty (fmt.marker) && isempty (fmt.linestyle))
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
70 [fmt.linestyle, fmt.marker] = __next_line_style__ ();
10575
3eba2cc7cbda Allow matlab style linestyles in errorbar plots
David Bateman <dbateman@free.fr>
parents: 10573
diff changeset
71 endif
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
72 hl = [(__line__ (hg, "linestyle", fmt.linestyle, "marker", fmt.marker,
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
73 "color", fmt.color)),
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
74 (__line__ (hg, "linestyle", "-", "marker", "none",
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
75 "color", fmt.color))];
6736
751f340d486c [project @ 2007-06-15 21:31:38 by jwe]
jwe
parents: 6448
diff changeset
76
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
77 switch (numel(varargin))
4897
89eee52fd4c7 [project @ 2004-06-03 23:07:55 by jwe]
jwe
parents: 4717
diff changeset
78 case 2
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
79 ydata = varargin{1}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
80 xdata = 1:numel(ydata);
10594
4b421123fd17 __errplot__.m: Fix bug parsing errorbar style.
Ben Abbott <bpabbott@mac.com>
parents: 10592
diff changeset
81 if (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
82 xldata = varargin{2}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
83 xudata = ldata;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
84 ldata = [];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
85 udata = [];
10594
4b421123fd17 __errplot__.m: Fix bug parsing errorbar style.
Ben Abbott <bpabbott@mac.com>
parents: 10592
diff changeset
86 elseif (strcmp (ifmt, "yerr") || strcmp (ifmt, "boxy"))
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
87 ldata = varargin{2}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
88 udata = ldata;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
89 xldata = [];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
90 xudata = [];
10573
d8894a2d0a03 Allow x, xy and box errorbars with different plotting syntax
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
91 else
10635
d1978e7364ad Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents: 10594
diff changeset
92 error ("errorbar: 2 column errorplot is only valid or xerr or yerr");
10573
d8894a2d0a03 Allow x, xy and box errorbars with different plotting syntax
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
93 endif
4897
89eee52fd4c7 [project @ 2004-06-03 23:07:55 by jwe]
jwe
parents: 4717
diff changeset
94 case 3
10594
4b421123fd17 __errplot__.m: Fix bug parsing errorbar style.
Ben Abbott <bpabbott@mac.com>
parents: 10592
diff changeset
95 if (strcmp (ifmt, "boxxy") || strcmp (ifmt, "xyerr"))
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
96 ydata = varargin{1}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
97 xdata = 1:numel(ydata);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
98 xldata = varargin{2}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
99 xudata = xldata;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
100 ldata = varargin{3}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
101 udata = ldata;
10594
4b421123fd17 __errplot__.m: Fix bug parsing errorbar style.
Ben Abbott <bpabbott@mac.com>
parents: 10592
diff changeset
102 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
103 xdata = varargin{1}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
104 ydata = varargin{2}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
105 xldata = varargin{3}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
106 xudata = xldata;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
107 ldata = [];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
108 udata = [];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
109 else # yerr or boxy
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
110 xdata = varargin{1}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
111 ydata = varargin{2}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
112 ldata = varargin{3}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
113 udata = ldata;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
114 xldata = [];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
115 xudata = [];
10573
d8894a2d0a03 Allow x, xy and box errorbars with different plotting syntax
David Bateman <dbateman@free.fr>
parents: 10549
diff changeset
116 endif
4897
89eee52fd4c7 [project @ 2004-06-03 23:07:55 by jwe]
jwe
parents: 4717
diff changeset
117 case 4
10594
4b421123fd17 __errplot__.m: Fix bug parsing errorbar style.
Ben Abbott <bpabbott@mac.com>
parents: 10592
diff changeset
118 if (strcmp (ifmt, "boxxy") || strcmp (ifmt, "xyerr"))
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
119 xdata = varargin{1}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
120 ydata = varargin{2}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
121 xldata = varargin{3}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
122 xudata = xldata;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
123 ldata = varargin{4}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
124 udata = ldata;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
125 elseif (strcmp (ifmt, "xerr") || strcmp (ifmt, "box"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
126 xdata = varargin{1}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
127 ydata = varargin{2}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
128 xldata = varargin{3}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
129 xudata = varargin{4}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
130 ldata = [];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
131 udata = [];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
132 else # yerr or boxy
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
133 xdata = varargin{1}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
134 ydata = varargin{2}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
135 ldata = varargin{3}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
136 udata = varargin{4}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
137 xldata = [];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
138 xudata = [];
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9896
diff changeset
139 endif
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
140 case 6 # boxxy, xyerr
10594
4b421123fd17 __errplot__.m: Fix bug parsing errorbar style.
Ben Abbott <bpabbott@mac.com>
parents: 10592
diff changeset
141 if (strcmp (ifmt, "boxxy") || strcmp (ifmt, "xyerr"))
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
142 xdata = varargin{1}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
143 ydata = varargin{2}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
144 xldata = varargin{3}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
145 xudata = varargin{4}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
146 ldata = varargin{5}(:,i);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
147 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
148 else
10635
d1978e7364ad Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents: 10594
diff changeset
149 error ("errorbar: error plot with 6 columns only valid for boxxy and xyerr");
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
150 endif
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
151 otherwise
10635
d1978e7364ad Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents: 10594
diff changeset
152 error ("errorbar: error plot requires 2, 3, 4 or 6 arguments.");
4897
89eee52fd4c7 [project @ 2004-06-03 23:07:55 by jwe]
jwe
parents: 4717
diff changeset
153 endswitch
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
154
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
155 addproperty ("xdata", hg, "data", xdata(:))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
156 addproperty ("ydata", hg, "data", ydata(:))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
157 addproperty ("ldata", hg, "data", ldata(:))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
158 addproperty ("udata", hg, "data", udata(:))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
159 addproperty ("xldata", hg, "data", xldata(:))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
160 addproperty ("xudata", hg, "data", xudata(:))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
161 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
162
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
163 addproperty ("color", hg, "linecolor", get (hl(1), "color"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
164 addproperty ("linewidth", hg, "linelinewidth", get (hl(1), "linewidth"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
165 addproperty ("linestyle", hg, "linelinestyle", get (hl(1), "linestyle"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
166 addproperty ("marker", hg, "linemarker", get (hl(1), "marker"))
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
167 addproperty ("markerfacecolor", hg, "linemarkerfacecolor",
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
168 get (hl(1), "markerfacecolor"))
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
169 addproperty ("markeredgecolor", hg, "linemarkerfacecolor",
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
170 get (hl(1), "markeredgecolor"))
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
171 addproperty ("markersize", hg, "linemarkersize",
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
172 get (hl(1), "markersize"))
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
173
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
174 fcn = {@update_props, hl};
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
175 addlistener (hg, "color", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
176 addlistener (hg, "linewidth", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
177 addlistener (hg, "linestyle", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
178 addlistener (hg, "marker", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
179 addlistener (hg, "markerfacecolor", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
180 addlistener (hg, "markersize", fcn);
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
181
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
182 fcn = {@update_data, hl};
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
183 addlistener (hg, "xdata", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
184 addlistener (hg, "ydata", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
185 addlistener (hg, "ldata", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
186 addlistener (hg, "udata", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
187 addlistener (hg, "xldata", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
188 addlistener (hg, "xudata", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
189 addlistener (hg, "format", fcn);
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
190
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
191 hax = ancestor (hg, "axes");
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
192 addlistener (hax, "xscale", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
193 addlistener (hax, "yscale", fcn);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
194
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
195 update_data (hg, [], hl)
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
196
5406
c49aec8a9080 [project @ 2005-07-08 15:25:43 by jwe]
jwe
parents: 5395
diff changeset
197 endfor
c49aec8a9080 [project @ 2005-07-08 15:25:43 by jwe]
jwe
parents: 5395
diff changeset
198
4007
31448e09d38e [project @ 2002-07-26 01:47:32 by jwe]
jwe
parents: 4006
diff changeset
199 endfunction
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
200
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
201 function [xdata, ydata] = errorbar_data (xdata, ydata, ldata, udata,
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
202 xldata, xudata, ifmt,
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
203 xscale, yscale)
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
204 if (strcmp (xscale, "linear"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
205 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
206 xlo = xdata - dx;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
207 xhi = xdata + dx;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
208 else
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
209 n = xdata > 0;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
210 rx = exp(0.01 * (max (log(xdata(n))) - min (log(xdata(n)))));
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
211 xlo = xdata/rx;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
212 xhi = xdata*rx;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
213 endif
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
214 if (strcmp (yscale, "linear"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
215 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
216 ylo = ydata - dy;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
217 yhi = ydata + dy;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
218 else
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
219 n = ydata > 0;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
220 ry = exp(0.01 * (max (log(ydata(n))) - min (log(ydata(n)))));
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
221 ylo = ydata/ry;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
222 yhi = ydata*ry;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
223 endif
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
224 nans = NaN + xdata(:);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
225 if (strcmp (ifmt, "yerr"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
226 xdata = [xdata, xdata, nans, ...
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
227 xlo, xhi, nans, ...
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
228 xlo, xhi, nans];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
229 ydata = [ydata-ldata, ydata+udata, nans, ...
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
230 ydata+udata, ydata+udata, nans, ...
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
231 ydata-ldata, ydata-ldata, nans];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
232 elseif (strcmp (ifmt, "xerr"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
233 xdata = [xdata-xldata, xdata+xudata, nans, ...
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
234 xdata+xudata, xdata+xudata, nans, ...
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
235 xdata-xldata, xdata-xldata, nans];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
236 ydata = [ydata, ydata, nans, ...
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
237 ylo, yhi, nans, ...
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
238 ylo, yhi, nans];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
239 elseif (strcmp (ifmt, "boxy"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
240 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
241 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
242 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
243 ydata-ldata, nans];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
244 elseif (strcmp (ifmt, "box"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
245 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
246 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
247 xdata-xldata, nans];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
248 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
249 elseif (strcmp (ifmt, "boxxy"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
250 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
251 xdata-xldata, nans];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
252 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
253 ydata-ldata, nans];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
254 elseif (strcmp (ifmt, "xyerr"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
255 [x1, y1] = errorbar_data (xdata, ydata, ldata, udata,
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
256 xldata, xudata, "xerr", xscale, yscale);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
257 [x2, y2] = errorbar_data (xdata, ydata, ldata, udata,
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
258 xldata, xudata, "yerr", xscale, yscale);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
259 xdata = [x1; x2];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
260 ydata = [y1; y2];
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
261 return
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
262 else
10635
d1978e7364ad Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents: 10594
diff changeset
263 error ("errorbar: valid error bar types are xerr, yerr, boxxy, and xyerr.")
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
264 endif
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
265 xdata = xdata.'(:);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
266 ydata = ydata.'(:);
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
267 endfunction
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
268
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
269 function update_props (hg, dummy, hl)
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
270 set (hl, "color", get (hg, "color"),
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
271 "linewidth", get (hg, "linewidth"));,
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
272 set (hl(1), "linestyle", get (hg, "linestyle"),
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
273 "marker", get (hg, "marker"),
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
274 "markersize", get (hg, "markersize"),
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
275 "markerfacecolor", get (hg, "markerfacecolor"),
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
276 "markeredgecolor", get (hg, "markeredgecolor"));
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
277 endfunction
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
278
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
279 function update_data (hg, dummy, hl)
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
280
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
281 if (strcmp (get (hg, "type"), "axes"))
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
282 hax = hg;
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
283 hg = ancestor (hl(1), "hggroup");
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
284 else
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
285 hax = ancestor (hg, "axes");
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
286 endif
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
287 xscale = get (hax, "xscale");
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
288 yscale = get (hax, "yscale");
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
289
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
290 xdata = get (hg, "xdata");
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
291 ydata = get (hg, "ydata");
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
292 ldata = get (hg, "ldata");
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
293 udata = get (hg, "udata");
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
294 xldata = get (hg, "xldata");
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
295 xudata = get (hg, "xudata");
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
296 ifmt = get (hg, "format");
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
297
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
298 set (hl(1), "xdata", xdata);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
299 set (hl(1), "ydata", ydata);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
300
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
301 [errorbar_xdata, errorbar_ydata] = ...
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
302 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
303 ifmt, xscale, yscale);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
304
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
305 set (hl(2), "xdata", errorbar_xdata);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
306 set (hl(2), "ydata", errorbar_ydata);
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
307
8258
2b408bbd8904 Add error bar series
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
308 endfunction
10592
f0a7a72c1fbf __errplot__.m: Implement errorbars in the Matlab style.
Ben Abbott <bpabbott@mac.com>
parents: 10590
diff changeset
309