yticklabels(labels)
yticklabels('auto')
yticklabels('manual')
mode = yticklabels('mode')
labels = yticklabels
yticklabels(ax, ...)
labels = yticklabels(ax)
| Parameter | Description |
|---|---|
| labels | string array, cell array of character vectors, or character vector used as y-axis tick labels. |
| ax | target axes object. If omitted, the current axes is used. |
| Parameter | Description |
|---|---|
| labels | current y-axis tick labels. |
| mode | current y-axis tick label mode: 'auto' or 'manual'. |
yticklabels sets or queries the YTickLabel property of an axes.
Assigning labels switches YTickLabelMode to manual. Use yticklabels('auto') to return to automatic labels.
f = figure();
barh([10 20 30 41]);
yticklabels({'April', 'May', 'June', 'July'});
f = figure();
ax = axes('Parent', f);
plot(ax, 1:4, [2 4 3 5]);
ax.YTick = 2:5;
yticklabels(ax, ["low"; "mid"; "high"; "top"]);
mode = yticklabels(ax, 'mode')