Mercurial > octave
annotate scripts/plot/draw/semilogxerr.m @ 32632:2e484f9f1f18 stable
maint: update Octave Project Developers copyright for the new year
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 22 Dec 2023 12:08:17 -0500 |
parents | 597f3ee61a48 |
children |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
3 ## Copyright (C) 2000-2024 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
4019 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
4019 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22367
diff
changeset
|
13 ## (at your option) any later version. |
4019 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22367
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22367
diff
changeset
|
18 ## GNU General Public License for more details. |
4019 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
7016 | 21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
4019 | 25 |
26 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20401
diff
changeset
|
27 ## @deftypefn {} {} semilogxerr (@var{y}, @var{ey}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20401
diff
changeset
|
28 ## @deftypefnx {} {} semilogxerr (@var{y}, @dots{}, @var{fmt}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20401
diff
changeset
|
29 ## @deftypefnx {} {} semilogxerr (@var{x}, @var{y}, @var{ey}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20401
diff
changeset
|
30 ## @deftypefnx {} {} semilogxerr (@var{x}, @var{y}, @var{err}, @var{fmt}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20401
diff
changeset
|
31 ## @deftypefnx {} {} semilogxerr (@var{x}, @var{y}, @var{lerr}, @var{uerr}, @var{fmt}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20401
diff
changeset
|
32 ## @deftypefnx {} {} semilogxerr (@var{x}, @var{y}, @var{ex}, @var{ey}, @var{fmt}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20401
diff
changeset
|
33 ## @deftypefnx {} {} semilogxerr (@var{x}, @var{y}, @var{lx}, @var{ux}, @var{ly}, @var{uy}, @var{fmt}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20401
diff
changeset
|
34 ## @deftypefnx {} {} semilogxerr (@var{x1}, @var{y1}, @dots{}, @var{fmt}, @var{xn}, @var{yn}, @dots{}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20401
diff
changeset
|
35 ## @deftypefnx {} {} semilogxerr (@var{hax}, @dots{}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20401
diff
changeset
|
36 ## @deftypefnx {} {@var{h} =} semilogxerr (@dots{}) |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
37 ## Produce 2-D plots using a logarithmic scale for the x-axis and errorbars |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
38 ## at each data point. |
17057
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
39 ## |
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
40 ## Many different combinations of arguments are possible. The most common |
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
41 ## form is |
4019 | 42 ## |
43 ## @example | |
44 ## semilogxerr (@var{x}, @var{y}, @var{ey}, @var{fmt}) | |
45 ## @end example | |
46 ## | |
47 ## @noindent | |
10687
a8ce6bdecce5
Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents:
10595
diff
changeset
|
48 ## which produces a semi-logarithmic plot of @var{y} versus @var{x} |
4019 | 49 ## with errors in the @var{y}-scale defined by @var{ey} and the plot |
28959
5394d688d456
doc: Use @code{} within alternate text for @xref,@pxref macros for better Info display.
Rik <rik@octave.org>
parents:
27984
diff
changeset
|
50 ## format defined by @var{fmt}. @xref{XREFerrorbar,,@code{errorbar}}, for |
5394d688d456
doc: Use @code{} within alternate text for @xref,@pxref macros for better Info display.
Rik <rik@octave.org>
parents:
27984
diff
changeset
|
51 ## available formats and additional information. |
17161
52931d71400f
doc: Document that first argument can be an axes handle for several plot functions.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
52 ## |
24431
0c6cedafc71e
doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
53 ## If the first argument @var{hax} is an axes handle, then plot into this axes, |
17161
52931d71400f
doc: Document that first argument can be an axes handle for several plot functions.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
54 ## rather than the current axes returned by @code{gca}. |
52931d71400f
doc: Document that first argument can be an axes handle for several plot functions.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
55 ## |
17057
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
56 ## @seealso{errorbar, semilogyerr, loglogerr} |
4019 | 57 ## @end deftypefn |
58 | |
17057
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
59 function h = semilogxerr (varargin) |
4019 | 60 |
17057
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
61 [hax, varargin] = __plt_get_axis_arg__ ("semilogxerr", varargin{:}); |
7216 | 62 |
17211
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17190
diff
changeset
|
63 oldfig = []; |
17301
68bcac3c043a
Correct inversion accidentally introduced in cset 87ba70043bfc.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
64 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
|
65 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
|
66 endif |
7207 | 67 unwind_protect |
17057
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
68 hax = newplot (hax); |
4019 | 69 |
17057
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
70 set (hax, "xscale", "log"); |
22367
459545bc9019
Use ishold () rather than ishold (hax) for performance.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
71 if (! ishold ()) |
17082
cb8543396024
Set minorticks for error bar plots with logarithmic axes.
Rik <rik@octave.org>
parents:
17057
diff
changeset
|
72 set (hax, "xminortick", "on"); |
cb8543396024
Set minorticks for error bar plots with logarithmic axes.
Rik <rik@octave.org>
parents:
17057
diff
changeset
|
73 endif |
17126
26589abbc78d
Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
74 |
20401
905fc6b85b4c
build: Consolidate __errcomm__.m and __errplot__.m to one file.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
75 htmp = __errplot__ ("semilogxerr", hax, varargin{:}); |
17082
cb8543396024
Set minorticks for error bar plots with logarithmic axes.
Rik <rik@octave.org>
parents:
17057
diff
changeset
|
76 |
17057
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
77 unwind_protect_cleanup |
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
78 if (! isempty (oldfig)) |
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
79 set (0, "currentfigure", oldfig); |
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
80 endif |
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
81 end_unwind_protect |
6302 | 82 |
17057
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
83 if (nargout > 0) |
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
84 h = htmp; |
abf6a6147f1a
loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
85 endif |
4019 | 86 |
87 endfunction | |
10595
46c8ecc4d565
Add demos to loglogerr.m, semilogxerr.m, & semilogyerr.m
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
88 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
89 |
10595
46c8ecc4d565
Add demos to loglogerr.m, semilogxerr.m, & semilogyerr.m
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
90 %!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
|
91 %! clf; |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
92 %! x = exp (log (0.01):0.2:log (10)); |
24711
752f61e812f4
Fix XXXerr plot demos which rely on wblpdf (bug #53072).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
93 %! wblpdf = @(x, scl, shp) shp*(scl^-shp) .* x.^(shp-1) .* exp (-(x/scl).^shp); |
10595
46c8ecc4d565
Add demos to loglogerr.m, semilogxerr.m, & semilogyerr.m
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
94 %! y = wblpdf (x, 2, 2); |
46c8ecc4d565
Add demos to loglogerr.m, semilogxerr.m, & semilogyerr.m
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
95 %! ey = 0.5*rand (size (y)) .* y; |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
96 %! semilogxerr (x, y, ey, "#~x-"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
97 %! xlim (x([1, end])); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
98 %! title ({"semilogxerr(): semilogx() plot with errorbars", ... |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
99 %! "X-axis is logarithmic"}); |