Produce a 2-D plot using a logarithmic scale for the x-axis.
See the documentation of plot for a description of the
arguments that semilogx will accept.
If the first argument hax is an axes handle, then plot into this axis,
rather than the current axes returned by gca.
The optional return value h is a graphics handle to the created plot.
See also: plot, semilogy, loglog.
The following code
clf;
x = 1:0.01:10;
y = (x .* (1 + rand (size (x)))) .^ 2;
semilogx (y, x);
title ({"semilogx() plot", "X-axis is logarithmic"});
Produces the following figure
| Figure 1 |
|---|
![]() |
The following code
clf;
x = logspace (-5, 1, 10);
y = logspace (-5, 1, 10);
subplot (1,2,1);
semilogx (x, y);
title ("semilogx (x, y)");
subplot (1,2,2);
semilogx (-x, y);
title ("semilogx (-x, y)");
Produces the following figure
| Figure 1 |
|---|
![]() |
The following code
clf;
x = logspace (-5, 1, 10);
y = logspace (-5, 1, 10);
subplot (1,2,1);
semilogx (x, y);
set (gca, "xdir", "reverse", "activepositionproperty", "outerposition");
title ({"semilogx (x, y)", "xdir = reversed"});
subplot (1,2,2);
semilogx (-x, y);
set (gca, "xdir", "reverse", "activepositionproperty", "outerposition");
title ({"semilogx (-x, y)", "xdir = reversed"});
Produces the following figure
| Figure 1 |
|---|
![]() |
Package: octave