ysecondarylabel

Sets the secondary label of the y-axis.

Category: Graphics > Formatting and Annotation

Syntax

ysecondarylabel(txt)

Sets the secondary label of the current axes.

ysecondarylabel(txt, Name, Value)

Sets text properties of the label.

ysecondarylabel(ax, ___)

Acts on the axes ax.

Description

The secondary label is a small text beside the end of the axis, where MATLAB shows an exponent multiplier such as \times10^{5}. Writing your own text there replaces that automatic content.

The string is stored in ax.YAxis.SecondaryLabel.String. It is separate from the main ylabel.

Input arguments

txt
Text for the secondary label.

Example

Custom secondary label

plot(1:3, [1 2 3]*1e5)
ysecondarylabel('scale factor')
ax = gca;
ax.YAxis.SecondaryLabel.String
Output
ans = 'scale factor'

Notes

ysecondarylabel has no output argument, so the text object cannot be captured with t = ysecondarylabel(...). Read the text from ax.YAxis.SecondaryLabel.String.

See also

xsecondarylabel ylabel ytickformat yticks