zticklabels
Sets or gets the text of the z-axis tick labels.
Category: Graphics > Formatting and Annotation
Syntax
zticklabels(labels)
Uses labels for the z ticks, in order.
lbl = zticklabels
Returns the current labels as a cell array.
zticklabels('auto')
Restores automatic labels.
Description
Custom labels let a numeric axis show names, such as 'low', 'mid' and 'high'. Pair the call with zticks so each label sits where you expect.
Input arguments
labels- Cell array of character vectors or a string array. If it is shorter than the number of ticks, the labels repeat.
Output arguments
lbl- Cell array of tick label text.
Example
Named z ticks
surf(peaks(10))
zticks([-5 0 5])
zticklabels({'low', 'mid', 'high'})