semilogy

Plots a line with a linear x-axis and a base-10 logarithmic y-axis.

Category: Graphics > 2-D and 3-D Plots

Syntax

semilogy(X, Y)

Plots Y against X with the y-axis on a log scale.

semilogy(X, Y, LineSpec)

Sets color, marker and line style with a short string.

h = semilogy(___)

Also returns the line handles.

Description

The arguments are the same as in plot. Exponential growth or decay turns into a straight line on a logarithmic y-axis, so the slope gives the rate directly.

Zero or negative values of Y cannot be shown on a log axis and are not drawn.

Input arguments

X, Y
Vectors or matrices of coordinates. Y must be positive to appear on a log axis.

Output arguments

h
Handles of the plotted lines.

Example

Exponential growth as a straight line

x = 0:10;
semilogy(x, 2.^x, '-o')
grid on

In the app, the figure is drawn below the code.

See also

semilogx loglog plot