I recently stumbled upon some weird behaviour when trying to generate several subplots with a logarithmic y-scale. The subplots are constructed in a loop, so that each subplot is generated exactly the same way, still the Y-scale differs between the various subplots even though they all have the same limits and tick definition, which does not make any sense to me. How can I make sure that the Y-scale and ticks are equal in all subplots? Below is an example that illustrates the problem (Matlab R2019a).
figure;for i=1:9 ax = subplot(3,3,i); plot(rand(5)); yticks([0:0.2:1]); ylim([0, 1]); set(ax, "YScale", "log"); end
Output:
The effect is especially clear on the third row of subplots where the y-ticks are shifted upwards and compressed relative to the other subplots.
Best Answer