MATLAB: R2019b tiled layout

MATLABplotting

Hi everybody,
I was playing with the new tiledlayout function.
But if you deviate from the default settings the colorbar looks strange.
Any ideas how to fix that? I tried to manipulate the colorbar position property but this yielded missing references to the colorbar object.
t = tiledlayout(1,2)
t.TileSpacing = 'compact';
nexttile
imagesc(rand(16))
axis image
colorbar
title('1')
nexttile
imagesc(rand(16))
axis normal
colorbar
title('2')

Best Answer

"the colorbar looks strange"
I assume you mean that the colorbar size doesn't scale with the axis size after applying axis image. This should probably be addressed by The MathWorks but in the mean time, you could use subplot() to define your axes and the colobars will scale to the axis size.
subplot(2,2,1)
imagesc(rand(16))
axis image
colorbar
title('1')
subplot(2,2,2)
imagesc(rand(16))
axis normal
colorbar
title('2')