1 ## Copyright (C) 1993-2012 John W. Eaton
3 ## This file is part of Octave.
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
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
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.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {} semilogy (@var{y})
21 ## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y})
22 ## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
23 ## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{fmt})
24 ## @deftypefnx {Function File} {} semilogy (@var{h}, @dots{})
25 ## @deftypefnx {Function File} {@var{h} =} semilogy (@dots{})
26 ## Produce a two-dimensional plot using a logarithmic scale for the @var{y}
27 ## axis. See the documentation of @code{plot} for a description of the
28 ## arguments that @code{semilogy} will accept.
30 ## The optional return value @var{h} is a graphics handle to the created plot.
31 ## @seealso{plot, semilogx, loglog}
36 function retval = semilogy (varargin)
38 [h, varargin, nargs] = __plt_get_axis_arg__ ("semilogy", varargin{:});
49 set (h, "yscale", "log");
50 if (any( strcmp (get (gca, "nextplot"), {"new", "replace"})))
51 set (h, "yminortick", "on");
54 tmp = __plt__ ("semilogy", h, varargin{:});
60 unwind_protect_cleanup
69 %! y = (x .* (1 + rand (size (x)))) .^ 2;
74 %! x = logspace (-5, 1, 10);
75 %! y = logspace (-5, 1, 10);
79 %! ylabel ("semilogy (x, y)");
83 %! ylabel ("semilogy (x, -y)");
87 %! x = logspace (-5, 1, 10);
88 %! y = logspace (-5, 1, 10);
92 %! set (gca, "ydir", "reverse", "activepositionproperty", "outerposition");
93 %! ylabel ({"semilogy (x, y)", "ydir = reversed"});
97 %! set (gca, "ydir", "reverse", "activepositionproperty", "outerposition");
98 %! ylabel ({"semilogy (x, -y)", "ydir = reversed"});
101 %! hf = figure ("visible", "off");
103 %! a = logspace (-5, 1, 10);
104 %! b = logspace (-5, 1, 10);
106 %! assert (get (gca, "yscale"), "log");
107 %! assert (get (gca, "xscale"), "linear");
108 %! unwind_protect_cleanup
110 %! end_unwind_protect
113 %! hf = figure ("visible", "off");
115 %! a = logspace (-5, 1, 10);
116 %! b =-logspace (-5, 1, 10);
119 %! assert (all (get (gca, "ytick") < 0));
120 %! unwind_protect_cleanup
122 %! end_unwind_protect