R2019b tiled layout

8 ビュー (過去 30 日間)
Joh Hag
Joh Hag 2020 年 1 月 25 日
コメント済み: Adam Danz 2020 年 1 月 28 日
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')

採用された回答

Adam Danz
Adam Danz 2020 年 1 月 26 日
編集済み: Adam Danz 2020 年 1 月 27 日
"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')
  2 件のコメント
Joh Hag
Joh Hag 2020 年 1 月 28 日
Hi Adam,
in the mean time I already went for the solution with a subplot. But I never really like the spacing between tiles in a subplot, thats why I tried tiledLayout.
Thanks anyway
-johannes
Adam Danz
Adam Danz 2020 年 1 月 28 日
There are a few ways around that.
1) After creating the subplots you can change their size and positions using the h.Position property where h is the subplot handle.
2) You can create your own axes using the axes('position',[L,R,H,V]) syntax.
3) You can use this file exchange function where you can set the margins sizes

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by