Documentation Center

  • Trial Software
  • Product Updates


Log-log scale plot


h = loglog(...)


loglog(Y) plots the columns of Y versus their index if Y contains real numbers. If Y contains complex numbers, loglog(Y) and loglog(real(Y),imag(Y)) are equivalent. loglog ignores the imaginary component in all other uses of this function.

loglog(X1,Y1,...) plots all Yn versus Xn pairs. If only one of Xn or Yn is a matrix, loglog plots the vector argument versus the rows or columns of the matrix, along the dimension of the matrix whose length matches the length of the vector. If the matrix is square, its columns plot against the vector if their lengths match.

loglog(X1,Y1,LineSpec,...) plots all lines defined by the Xn,Yn,LineSpec triples, where LineSpec determines line type, marker symbol, and color of the plotted lines. You can mix Xn,Yn,LineSpec triples with Xn,Yn pairs, for example,


loglog(...,'PropertyName',PropertyValue,...) sets property values for all lineseries properties graphics objects created by loglog.

h = loglog(...) returns a column vector of lineseries handles, one handle per line.

If you do not specify a color when plotting more than one line, loglog automatically cycles through the colors and line styles in the order specified by the current axes.

If you attempt to add a loglog, semilogx, or semilogy plot to a linear axis mode graph with hold on, the axis mode remains as it is and the new data plots as linear.

Renderer Support

The OpenGL® renderer does not support logarithmic-scale axes. MATLAB® automatically selects a different renderer when using logarithmic scaling. If you set the figure Renderer property to opengl, axis scales become linear. See the figure Renderer property for more information on renderers.


expand all

Logarithmic Scale for Both Axes

Create a plot using a logarithmic scale for both the x-axis and the y-axis. Set the LineSpec string so that loglog plots using a line with square markers. Display the grid.

x = logspace(-1,2);
y = exp(x);

grid on

See Also

| | |

Was this topic helpful?