yscale

Gets or sets the scale of the y-axis, linear or logarithmic.

Category: Graphics > Formatting and Annotation

Syntax

yscale(option)

Sets the scale to 'linear' or 'log'.

sc = yscale

Returns the current scale as text.

yscale(ax, ___)

Acts on the axes ax.

Description

A logarithmic axis shows equal ratios as equal distances, which suits data that spans several orders of magnitude. Only positive values can be drawn on it; zero and negative values are omitted.

The setting is stored in the axes property YScale. semilogx and loglog draw a plot and set the scale in a single call.

Input arguments

option
'linear' (default) or 'log'.

Output arguments

sc
Current scale, 'linear' or 'log'.

Example

Logarithmic y-axis

x = 1:6;
plot(x, 10.^x)
yscale('log')
yscale
Output
ans = 'log'

See also

xscale semilogy loglog ylim yticks