MATLAB: YTickLabels repeating themselves

barMATLABylim;ytickyticklabel

Hello, everyone,
I came across this unusual…bug? feature? today as I was designing something in the App Designer.
This portion of the program simply takes three double values and plots them into the three axes shown below. The YLim and YTick/YTickLabel values have been set manually in the axes as [0,100] and [0,20,40,60,80,100] for the far left, [0,10^6] and [0,10^1,10^2,10^3,10^4,10^5,10^6] for the middle, and [0,1000] and [0,200,400,600,800,1000] for the far right. When I plot the values, however, not only do the YTickLabels change, they also bizarrely jump from the upper limit of the YLim range back to the lower limit of the YLim range, as can be seen in the far left and far right axes, where the value jumps from 100 up to zero or 1000 up to zero.
As you can see from the mouseover, the values each read correctly in the axes, and the heights of the bar graphs are proportional to where the values would be located if the YTickLabels were displaying correctly. I've read all the documentation I can and searched Answers for hours trying to find out why this might be happening. Any ideas?
Thanks,
Chris

Best Answer

Not a bug.
From the table of uiaxes properties in the documentation, specifically the entry for XTickLabel / YTickLabel / ZTickLabel, "Tick labels, specified as a cell array of character vectors, string array, or categorical array. If you do not want tick labels to show, then specify an empty cell array {}. If you do not specify enough labels for all the ticks values, then the labels repeat." The same note appears in the the documentation for axes properties as well so I'll use a plain old axes for this example.
ax = axes;
set(ax, 'YTick', 0:0.25:1)
set(ax, 'YTickLabel', ["1"; "2"])
5 tick locations and 2 tick labels means the first tick gets the first label, the second tick the second label, the third tick the first label again, etc.