annotate scripts/plot/loglogerr.m @ 17211:87ba70043bfc

Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations. * scripts/plot/area.m, scripts/plot/axis.m, scripts/plot/caxis.m, scripts/plot/comet.m, scripts/plot/comet3.m, scripts/plot/compass.m, scripts/plot/contour.m, scripts/plot/contour3.m, scripts/plot/contourf.m, scripts/plot/cylinder.m, scripts/plot/ellipsoid.m, scripts/plot/errorbar.m, scripts/plot/feather.m, scripts/plot/fill.m, scripts/plot/loglog.m, scripts/plot/loglogerr.m, scripts/plot/mesh.m, scripts/plot/meshc.m, scripts/plot/meshz.m, scripts/plot/pcolor.m, scripts/plot/pie.m, scripts/plot/pie3.m, scripts/plot/plot.m, scripts/plot/plot3.m, scripts/plot/polar.m, scripts/plot/private/__bar__.m, scripts/plot/private/__ezplot__.m, scripts/plot/private/__stem__.m, scripts/plot/quiver.m, scripts/plot/quiver3.m, scripts/plot/rectangle.m, scripts/plot/ribbon.m, scripts/plot/rose.m, scripts/plot/scatter.m, scripts/plot/scatter3.m, scripts/plot/semilogx.m, scripts/plot/semilogxerr.m, scripts/plot/semilogy.m, scripts/plot/semilogyerr.m, scripts/plot/slice.m, scripts/plot/sphere.m, scripts/plot/stairs.m, scripts/plot/surf.m, scripts/plot/surfc.m, scripts/plot/surfl.m, scripts/plot/surfnorm.m, scripts/time/datetick.m: Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
author Rik <rik@octave.org>
date Fri, 09 Aug 2013 19:26:55 -0700
parents df4c4b7708a4
children 68bcac3c043a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 14092
diff changeset
1 ## Copyright (C) 2000-2012 Teemu Ikonen
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
2 ##
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
4 ##
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
6 ## 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
7 ## 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
8 ## your option) any later version.
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
9 ##
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
14 ##
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
15 ## 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
16 ## 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
17 ## <http://www.gnu.org/licenses/>.
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
18
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
16814
64e7bb01fce2 doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents: 14363
diff changeset
20 ## @deftypefn {Function File} {} loglogerr (@var{args})
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17082
diff changeset
21 ## @deftypefnx {Function File} {} loglogerr (@var{hax}, @dots{})
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17082
diff changeset
22 ## @deftypefnx {Function File} {@var{h} =} loglogerr (@dots{})
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17082
diff changeset
23 ## Produce 2-D plots on a double logarithm axis with errorbars.
17057
abf6a6147f1a loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
24 ##
abf6a6147f1a loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
25 ## 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
26 ## form is
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
27 ##
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
28 ## @example
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
29 ## loglogerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
30 ## @end example
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
31 ##
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
32 ## @noindent
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
33 ## which produces a double logarithm plot of @var{y} versus @var{x}
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
34 ## with errors in the @var{y}-scale defined by @var{ey} and the plot
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17082
diff changeset
35 ## format defined by @var{fmt}. @xref{XREFerrorbar,,errorbar}, for available
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17082
diff changeset
36 ## 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: 17122
diff changeset
37 ##
52931d71400f doc: Document that first argument can be an axes handle for several plot functions.
Rik <rik@octave.org>
parents: 17122
diff changeset
38 ## If the first argument @var{hax} is an axes handle, then plot into this axis,
52931d71400f doc: Document that first argument can be an axes handle for several plot functions.
Rik <rik@octave.org>
parents: 17122
diff changeset
39 ## rather than the current axes returned by @code{gca}.
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6448
diff changeset
40 ## @seealso{errorbar, semilogxerr, semilogyerr}
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
41 ## @end deftypefn
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
42
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
43 ## Created: 20.2.2001
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
44 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
45 ## Keywords: errorbar, plotting
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
46
17057
abf6a6147f1a loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
47 function h = loglogerr (varargin)
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
48
17057
abf6a6147f1a loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
49 [hax, varargin] = __plt_get_axis_arg__ ("loglogerr", varargin{:});
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7207
diff changeset
50
17211
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17190
diff changeset
51 oldfig = [];
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17190
diff changeset
52 if (isempty (hax))
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17190
diff changeset
53 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
54 endif
7207
71c03c7239fb [project @ 2007-11-28 02:19:25 by jwe]
jwe
parents: 7017
diff changeset
55 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
56 hax = newplot (hax);
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
57
17057
abf6a6147f1a loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
58 set (hax, "xscale", "log", "yscale", "log");
17082
cb8543396024 Set minorticks for error bar plots with logarithmic axes.
Rik <rik@octave.org>
parents: 17057
diff changeset
59 if (! ishold (hax))
cb8543396024 Set minorticks for error bar plots with logarithmic axes.
Rik <rik@octave.org>
parents: 17057
diff changeset
60 set (hax, "xminortick", "on", "yminortick", "on");
cb8543396024 Set minorticks for error bar plots with logarithmic axes.
Rik <rik@octave.org>
parents: 17057
diff changeset
61 endif
17057
abf6a6147f1a loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
62 htmp = __errcomm__ ("loglogerr", hax, varargin{:});
17082
cb8543396024 Set minorticks for error bar plots with logarithmic axes.
Rik <rik@octave.org>
parents: 17057
diff changeset
63
17057
abf6a6147f1a loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
64 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
65 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
66 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
67 endif
abf6a6147f1a loglogerr.m, semilogyerr.m, semilogxerr.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 16814
diff changeset
68 end_unwind_protect
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6257
diff changeset
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 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
71 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
72 endif
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
73
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
74 endfunction
10595
46c8ecc4d565 Add demos to loglogerr.m, semilogxerr.m, & semilogyerr.m
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
75
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
76
10595
46c8ecc4d565 Add demos to loglogerr.m, semilogxerr.m, & semilogyerr.m
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
77 %!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
78 %! clf;
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
79 %! x = exp (log (0.01):0.2:log (10));
10595
46c8ecc4d565 Add demos to loglogerr.m, semilogxerr.m, & semilogyerr.m
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
80 %! y = wblpdf (x, 3, 2);
46c8ecc4d565 Add demos to loglogerr.m, semilogxerr.m, & semilogyerr.m
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
81 %! eyu = 2*rand (size (y)) .* y;
46c8ecc4d565 Add demos to loglogerr.m, semilogxerr.m, & semilogyerr.m
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
82 %! eyl = 0.5*rand (size (y)) .* y;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
83 %! loglogerr (x, y, eyl, eyu, '#~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
84 %! xlim (x([1, end]));
17190
df4c4b7708a4 Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents: 17161
diff changeset
85 %! title ({'loglogerr(): loglog() plot with errorbars', ...
df4c4b7708a4 Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents: 17161
diff changeset
86 %! 'Both axes are logarithmic'});
10595
46c8ecc4d565 Add demos to loglogerr.m, semilogxerr.m, & semilogyerr.m
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
87