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} {} loglog (@var{y})
21 ## @deftypefnx {Function File} {} loglog (@var{x}, @var{y})
22 ## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
23 ## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{fmt})
24 ## @deftypefnx {Function File} {} loglog (@var{h}, @dots{})
25 ## @deftypefnx {Function File} {@var{h} =} loglog (@dots{})
26 ## Produce a two-dimensional plot using log scales for both axes. See
27 ## the documentation of @code{plot} for a description of the arguments
28 ## that @code{loglog} will accept.
30 ## The optional return value @var{h} is a graphics handle to the created plot.
31 ## @seealso{plot, semilogx, semilogy}
36 function retval = loglog (varargin)
38 [h, varargin, nargs] = __plt_get_axis_arg__ ("loglog", varargin{:});
49 set (h, "xscale", "log", "yscale", "log");
50 if (any( strcmp (get (gca, "nextplot"), {"new", "replace"})))
51 set (h, "xminortick", "on", "yminortick", "on");
54 tmp = __plt__ ("loglog", h, varargin{:});
59 unwind_protect_cleanup
68 %! x = sort ((t .* (1 + rand (size (t)))) .^ 2);
69 %! y = ((t .* (1 + rand (size (t)))) .^ 2);
74 %! a = logspace (-5, 1, 10);
75 %! b =-logspace (-5, 1, 10);
79 %! xlabel ('loglog (a, b)')
82 %! loglog (a, abs (b))
83 %! set (gca, 'ydir', 'reverse')
84 %! xlabel ('loglog (a, abs (b))')
87 %! hf = figure ("visible", "off");
89 %! a = logspace (-5, 1, 10);
90 %! b = logspace (-5, 1, 10);
92 %! assert (get (gca, "yscale"), "log");
93 %! assert (get (gca, "xscale"), "log");
94 %! unwind_protect_cleanup
99 %! hf = figure ("visible", "off");
101 %! a = logspace (-5, 1, 10);
102 %! b =-logspace (-5, 1, 10);
105 %! assert (all (get (gca, "ytick") < 0));
106 %! unwind_protect_cleanup
108 %! end_unwind_protect