Mercurial > hg > octave-nkf
annotate scripts/plot/draw/errorbar.m @ 20737:2d9ec16fa960
Print error, rather than aborting, if mex function mxIsFromGlobalWS is used (bug #46070).
* mex.cc (mxIsFromGlobalWS): Call mexErrMsgTxt rather than abort() in function.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 29 Sep 2015 12:00:11 -0700 |
parents | 905fc6b85b4c |
children |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19793
diff
changeset
|
1 ## Copyright (C) 2000-2015 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 |
19 ## -*- texinfo -*- | |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
20 ## @deftypefn {Function File} {} errorbar (@var{y}, @var{ey}) |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
21 ## @deftypefnx {Function File} {} errorbar (@var{y}, @dots{}, @var{fmt}) |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
22 ## @deftypefnx {Function File} {} errorbar (@var{x}, @var{y}, @var{ey}) |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
23 ## @deftypefnx {Function File} {} errorbar (@var{x}, @var{y}, @var{err}, @var{fmt}) |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
24 ## @deftypefnx {Function File} {} errorbar (@var{x}, @var{y}, @var{lerr}, @var{uerr}, @var{fmt}) |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
25 ## @deftypefnx {Function File} {} errorbar (@var{x}, @var{y}, @var{ex}, @var{ey}, @var{fmt}) |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
26 ## @deftypefnx {Function File} {} errorbar (@var{x}, @var{y}, @var{lx}, @var{ux}, @var{ly}, @var{uy}, @var{fmt}) |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
27 ## @deftypefnx {Function File} {} errorbar (@var{x1}, @var{y1}, @dots{}, @var{fmt}, @var{xn}, @var{yn}, @dots{}) |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17059
diff
changeset
|
28 ## @deftypefnx {Function File} {} errorbar (@var{hax}, @dots{}) |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17059
diff
changeset
|
29 ## @deftypefnx {Function File} {@var{h} =} errorbar (@dots{}) |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
30 ## Create a 2-D plot with errorbars. |
17059
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
31 ## |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
32 ## Many different combinations of arguments are possible. The simplest form is |
3718 | 33 ## |
34 ## @example | |
35 ## errorbar (@var{y}, @var{ey}) | |
36 ## @end example | |
37 ## | |
38 ## @noindent | |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
39 ## where the first argument is taken as the set of @var{y} coordinates, the |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
40 ## second argument @var{ey} are the errors around the @var{y} values, and the |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
41 ## @var{x} coordinates are taken to be the indices of the elements |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
42 ## (@code{1:numel (@var{y})}). |
3718 | 43 ## |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
44 ## The general form of the function is |
3718 | 45 ## |
46 ## @example | |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
47 ## errorbar (@var{x}, @var{y}, @var{err1}, @dots{}, @var{fmt}, @dots{}) |
3718 | 48 ## @end example |
49 ## | |
50 ## @noindent | |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
51 ## After the @var{x} and @var{y} arguments there can be 1, 2, or 4 |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
52 ## parameters specifying the error values depending on the nature of the error |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
53 ## values and the plot format @var{fmt}. |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
54 ## |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
55 ## @table @asis |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
56 ## @item @var{err} (scalar) |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
57 ## When the error is a scalar all points share the same error value. |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
58 ## The errorbars are symmetric and are drawn from @var{data}-@var{err} to |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
59 ## @var{data}+@var{err}. |
19790
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18415
diff
changeset
|
60 ## The @var{fmt} argument determines whether @var{err} is in the x-direction, |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
61 ## y-direction (default), or both. |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
62 ## |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
63 ## @item @var{err} (vector or matrix) |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
64 ## Each data point has a particular error value. |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 ## The errorbars are symmetric and are drawn from @var{data}(n)-@var{err}(n) to |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 ## @var{data}(n)+@var{err}(n). |
3718 | 67 ## |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
68 ## @item @var{lerr}, @var{uerr} (scalar) |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
69 ## The errors have a single low-side value and a single upper-side value. |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
70 ## The errorbars are not symmetric and are drawn from @var{data}-@var{lerr} to |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
71 ## @var{data}+@var{uerr}. |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
72 ## |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
73 ## @item @var{lerr}, @var{uerr} (vector or matrix) |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
74 ## Each data point has a low-side error and an upper-side error. |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
75 ## The errorbars are not symmetric and are drawn from |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
76 ## @var{data}(n)-@var{lerr}(n) to @var{data}(n)+@var{uerr}(n). |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
77 ## @end table |
3718 | 78 ## |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
79 ## Any number of data sets (@var{x1},@var{y1}, @var{x2},@var{y2}, @dots{}) may |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
80 ## appear as long as they are separated by a format string @var{fmt}. |
6895 | 81 ## |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
82 ## If @var{y} is a matrix, @var{x} and the error parameters must also be |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
83 ## matrices having the same dimensions. The columns of @var{y} are plotted |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
84 ## versus the corresponding columns of @var{x} and errorbars are taken from |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
85 ## the corresponding columns of the error parameters. |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
86 ## |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
87 ## If @var{fmt} is missing, the yerrorbars ("~") plot style is assumed. |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
88 ## |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
89 ## If the @var{fmt} argument is supplied then it is interpreted, as in normal |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
90 ## plots, to specify the line style, marker, and color. In addition, |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
91 ## @var{fmt} may include an errorbar style which @strong{must precede} the |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
92 ## ordinary format codes. The following errorbar styles are supported: |
3718 | 93 ## |
94 ## @table @samp | |
95 ## @item ~ | |
96 ## Set yerrorbars plot style (default). | |
97 ## | |
98 ## @item > | |
99 ## Set xerrorbars plot style. | |
100 ## | |
101 ## @item ~> | |
102 ## Set xyerrorbars plot style. | |
103 ## | |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
104 ## @item #~ |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
105 ## Set yboxes plot style. |
3718 | 106 ## |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
107 ## @item # |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
108 ## Set xboxes plot style. |
3718 | 109 ## |
110 ## @item #~> | |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
111 ## Set xyboxes plot style. |
3718 | 112 ## @end table |
113 ## | |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17059
diff
changeset
|
114 ## If the first argument @var{hax} is an axes handle, then plot into this axis, |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17059
diff
changeset
|
115 ## rather than the current axes returned by @code{gca}. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17059
diff
changeset
|
116 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17059
diff
changeset
|
117 ## The optional return value @var{h} is a handle to the hggroup object |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17059
diff
changeset
|
118 ## representing the data plot and errorbars. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17059
diff
changeset
|
119 ## |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
120 ## Note: For compatibility with @sc{matlab} a line is drawn through all data |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
121 ## points. However, most scientific errorbar plots are a scatter plot of |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
122 ## points with errorbars. To accomplish this, add a marker style to the |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
123 ## @var{fmt} argument such as @qcode{"."}. Alternatively, remove the line |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
124 ## by modifying the returned graphic handle with |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
125 ## @code{set (h, "linestyle", "none")}. |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
126 ## |
3718 | 127 ## Examples: |
128 ## | |
129 ## @example | |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
130 ## errorbar (@var{x}, @var{y}, @var{ex}, ">.r") |
3718 | 131 ## @end example |
132 ## | |
10846
a4f482e66b65
Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents:
10591
diff
changeset
|
133 ## @noindent |
6895 | 134 ## produces an xerrorbar plot of @var{y} versus @var{x} with @var{x} |
18415
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
135 ## errorbars drawn from @var{x}-@var{ex} to @var{x}+@var{ex}. The marker |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
136 ## @qcode{"."} is used so no connecting line is drawn and the errorbars |
238aa26b30e3
doc: Re-write documentation for errorbar family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
137 ## appear in red. |
3718 | 138 ## |
139 ## @example | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
140 ## @group |
6895 | 141 ## errorbar (@var{x}, @var{y1}, @var{ey}, "~", |
142 ## @var{x}, @var{y2}, @var{ly}, @var{uy}) | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
143 ## @end group |
3718 | 144 ## @end example |
145 ## | |
10846
a4f482e66b65
Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents:
10591
diff
changeset
|
146 ## @noindent |
6895 | 147 ## produces yerrorbar plots with @var{y1} and @var{y2} versus @var{x}. |
3718 | 148 ## Errorbars for @var{y1} are drawn from @var{y1}-@var{ey} to |
149 ## @var{y1}+@var{ey}, errorbars for @var{y2} from @var{y2}-@var{ly} to | |
150 ## @var{y2}+@var{uy}. | |
151 ## | |
152 ## @example | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
153 ## @group |
6895 | 154 ## errorbar (@var{x}, @var{y}, @var{lx}, @var{ux}, |
155 ## @var{ly}, @var{uy}, "~>") | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
156 ## @end group |
3718 | 157 ## @end example |
158 ## | |
10846
a4f482e66b65
Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents:
10591
diff
changeset
|
159 ## @noindent |
6895 | 160 ## produces an xyerrorbar plot of @var{y} versus @var{x} in which |
161 ## @var{x} errorbars are drawn from @var{x}-@var{lx} to @var{x}+@var{ux} | |
162 ## and @var{y} errorbars from @var{y}-@var{ly} to @var{y}+@var{uy}. | |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17059
diff
changeset
|
163 ## @seealso{semilogxerr, semilogyerr, loglogerr, plot} |
3718 | 164 ## @end deftypefn |
165 | |
166 ## Created: 18.7.2000 | |
167 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> | |
168 ## Keywords: errorbar, plotting | |
169 | |
17059
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
170 function h = errorbar (varargin) |
3718 | 171 |
17059
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
172 [hax, varargin] = __plt_get_axis_arg__ ("errorbar", varargin{:}); |
7216 | 173 |
17211
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17190
diff
changeset
|
174 oldfig = []; |
17301
68bcac3c043a
Correct inversion accidentally introduced in cset 87ba70043bfc.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
175 if (! isempty (hax)) |
17211
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17190
diff
changeset
|
176 oldfig = get (0, "currentfigure"); |
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17190
diff
changeset
|
177 endif |
7207 | 178 unwind_protect |
17059
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
179 hax = newplot (hax); |
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
180 |
20611
905fc6b85b4c
build: Consolidate __errcomm__.m and __errplot__.m to one file.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
181 htmp = __errplot__ ("errorbar", hax, varargin{:}); |
17059
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
182 unwind_protect_cleanup |
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
183 if (! isempty (oldfig)) |
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
184 set (0, "currentfigure", oldfig); |
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
185 endif |
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
186 end_unwind_protect |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7216
diff
changeset
|
187 |
17059
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
188 if (nargout > 0) |
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
189 h = htmp; |
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
190 endif |
3718 | 191 |
192 endfunction | |
8258 | 193 |
194 | |
195 %!demo | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
196 %! clf; |
11363
a0dfd7e8e3e2
Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents:
11099
diff
changeset
|
197 %! rand_1x11_data1 = [0.82712, 0.50325, 0.35613, 0.77089, 0.20474, 0.69160, 0.30858, 0.88225, 0.35187, 0.14168, 0.54270]; |
a0dfd7e8e3e2
Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents:
11099
diff
changeset
|
198 %! rand_1x11_data2 = [0.506375, 0.330106, 0.017982, 0.859270, 0.140641, 0.327839, 0.275886, 0.162453, 0.807592, 0.318509, 0.921112]; |
a0dfd7e8e3e2
Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents:
11099
diff
changeset
|
199 %! errorbar (0:10, rand_1x11_data1, 0.25*rand_1x11_data2); |
17190
df4c4b7708a4
Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
200 %! title ('errorbar() with Y errorbars'); |
11363
a0dfd7e8e3e2
Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents:
11099
diff
changeset
|
201 |
a0dfd7e8e3e2
Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents:
11099
diff
changeset
|
202 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
203 %! clf; |
11363
a0dfd7e8e3e2
Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents:
11099
diff
changeset
|
204 %! rand_1x11_data3 = [0.423650, 0.142331, 0.213195, 0.129301, 0.975891, 0.012872, 0.635327, 0.338829, 0.764997, 0.401798, 0.551850]; |
a0dfd7e8e3e2
Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents:
11099
diff
changeset
|
205 %! rand_1x11_data4 = [0.682566, 0.456342, 0.132390, 0.341292, 0.108633, 0.601553, 0.040455, 0.146665, 0.309187, 0.586291, 0.540149]; |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
206 %! errorbar (0:10, rand_1x11_data3, rand_1x11_data4, '>'); |
17190
df4c4b7708a4
Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
207 %! title ('errorbar() with X errorbars'); |
10589 | 208 |
209 %!demo | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
210 %! clf; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
211 %! x = 0:0.5:2*pi; |
17059
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
212 %! err = x/30; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
213 %! y1 = sin (x); |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
214 %! y2 = cos (x); |
17190
df4c4b7708a4
Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
215 %! errorbar (x, y1, err, '~', x, y2, err, '>'); |
19066
cafffc1b70b1
update plot demo blocks for compare_plot_demos
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18415
diff
changeset
|
216 %! legend ('Y errbar', 'X errbar'); |
17190
df4c4b7708a4
Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
217 %! title ('errorbar() with 2 datasets'); |
df4c4b7708a4
Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
218 |
10589 | 219 |
220 %!demo | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
221 %! clf; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
222 %! x = 0:0.5:2*pi; |
17059
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
223 %! err = x/30; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
224 %! y1 = sin (x); |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
225 %! y2 = cos (x); |
17190
df4c4b7708a4
Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
226 %! errorbar (x, y1, err, err, '#r', x, y2, err, err, '#~'); |
19066
cafffc1b70b1
update plot demo blocks for compare_plot_demos
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18415
diff
changeset
|
227 %! legend ('X errbox', 'Y errbox'); |
17190
df4c4b7708a4
Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
228 %! title ('errorbar() with error boxes'); |
10589 | 229 |
230 %!demo | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
231 %! clf; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
232 %! x = 0:0.5:2*pi; |
17059
c935a0db31c6
errorbar.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
233 %! err = x/30; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
234 %! y1 = sin (x); |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
235 %! y2 = cos (x); |
17190
df4c4b7708a4
Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
236 %! errorbar (x, y1, err, err, err, err, '~>', ... |
df4c4b7708a4
Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
237 %! x, y2, err, err, err, err, '#~>-*'); |
19066
cafffc1b70b1
update plot demo blocks for compare_plot_demos
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18415
diff
changeset
|
238 %! legend ('X-Y errbars', 'X-Y errboxes'); |
17190
df4c4b7708a4
Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
239 %! title ('errorbar() with X-Y errorbars and error boxes'); |
10589 | 240 |
17435
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
241 ## Invisible figure used for tests |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
242 %!shared hf, hax |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
243 %! hf = figure ("visible", "off"); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
244 %! hax = axes; |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
245 |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
246 %!error errorbar () |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
247 %!error errorbar (1) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
248 %!error <data argument 1 must be numeric> errorbar (hax, {1}, 2) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
249 %!error <data argument 2 must be numeric> errorbar (hax, 1, {2}) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
250 %!error <size of argument 2 does not match others> errorbar (hax, 1, 1:2) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
251 %!error <size of argument 3 does not match others> errorbar (hax, 1, 2, 3:4) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
252 %!error <too many arguments to plot> errorbar (1,2,3,4,5,6,7) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
253 |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
254 %!error <2 column errorplot is only valid for xerr> errorbar (1,2, "~>") |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
255 %!error <6 columns only valid for xyerr and boxxy> errorbar (1,2,3,4,5,6, "~") |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
256 %!error <error plot requires 2, 3, 4, or 6 arguments> errorbar (1,2,3,4,5) |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
257 |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
258 ## Close figure used for testing |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
259 %!test |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
260 %! close (hf); |
4a6a4657fdf2
Overhaul errorbar family of functions.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
261 |