Main Content

Semilog plot (*x*-axis has log scale)

`semilogx(`

plots
`X`

,`Y`

)*x*- and *y*-coordinates using a base-10 logarithmic
scale on the *x*-axis and a linear scale on the *y*-axis.

To plot a set of coordinates connected by line segments, specify

`X`

and`Y`

as vectors of the same length.To plot multiple sets of coordinates on the same set of axes, specify at least one of

`X`

or`Y`

as a matrix.

`semilogx(`

plots `Y`

)`Y`

against an implicit set of *x*-coordinates.

If

`Y`

is a vector, the*x*-coordinates range from 1 to`length(Y)`

.If

`Y`

is a matrix, the plot contains one line for each column in`Y`

. The*x*-coordinates range from 1 to the number of rows in`Y`

.

If `Y`

contains complex numbers,
`semilogx`

plots the imaginary part of `Y`

versus
the real part of `Y`

. However, if you specify both `X`

and `Y`

, MATLAB^{®} ignores the imaginary part.

`semilogx(___,`

specifies `Name,Value`

)`Line`

properties using one or more
`Name,Value`

pair arguments. The properties apply to all the plotted
lines. Specify the `Name,Value`

pairs after all the arguments in any of
the previous syntaxes. For a list of properties, see Line Properties.

`semilogx(`

displays the
plot in the target axes. Specify the axes as the first argument in any of the previous
syntaxes.`ax`

,___)

`lineobj = semilogx(___)`

returns a
`Line`

object or an array of `Line`

objects. Use
`lineobj`

to modify properties of the plot after creating it. For a
list of properties, see Line Properties.

The

`semilogx`

function uses colors and line styles based on the`ColorOrder`

and`LineStyleOrder`

properties of the axes.`semilogx`

cycles through the colors with the first line style. Then, it cycles through the colors again with each additional line style.You can change the colors and the line styles after plotting by setting the

`ColorOrder`

or`LineStyleOrder`

properties on the axes. You can also call the`colororder`

function to change the color order for all the axes in the figure.

The `semilogx`

function plots *x*-coordinates on a log
scale by setting the `XScale`

property of the axes to
`'log'`

. However, if the axes `hold`

state is `'on'`

before you call
`semilogx`

, the property does not change, and the
*x*-coordinates might display on a linear scale.