xsecondarylabel
Sets the secondary label of the x-axis.
Category: Graphics > Formatting and Annotation
Syntax
xsecondarylabel(txt)
Sets the secondary label of the current axes.
xsecondarylabel(txt, Name, Value)
Sets text properties of the label.
xsecondarylabel(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} or the year and month of a date axis. Writing your own text there replaces that automatic content.
The string is stored in ax.XAxis.SecondaryLabel.String. It is separate from the main xlabel.
Input arguments
txt- Text for the secondary label.
Example
Custom secondary label
plot([1 2 3]*1e5, 1:3)
xsecondarylabel('scale factor')
ax = gca;
ax.XAxis.SecondaryLabel.String
Output
ans = 'scale factor'
Notes
xsecondarylabel has no output argument, so the text object cannot be captured with t = xsecondarylabel(...). Read the text from ax.XAxis.SecondaryLabel.String.