フィルターのクリア

Colorbars belonging to more than one subplot/axis

1 回表示 (過去 30 日間)
dj1du
dj1du 2022 年 6 月 19 日
コメント済み: Bjorn Gustavsson 2022 年 6 月 20 日
Good evening,
I want to plot four different variables var1, var2, var3, var4 as color values on a triangular mesh. The first two variables should be represented by one single colorbar and the last two variables by another colorbar. By which commands can I achieve this?
Thank's a lot for your help!
figure(1)
set(gcf, 'Position', [100, 800, 1400, 300])
ha=tight_subplot(2,2,[0.08 0.05],[0.1 0.01],[0.0 0.1])
axes(ha(1))
trisurf(T,x,y,z,var1)
axes(ha(2))
trisurf(T,x,y,z,var2)
axes(ha(3))
trisurf(T,x,y,z,var3)
axes(ha(4))
trisurf(T,x,y,z,var4)
  2 件のコメント
Image Analyst
Image Analyst 2022 年 6 月 19 日
Do you have an example of what you'd like it to look like? Also, include function tight_subplot so we can run your code.
dj1du
dj1du 2022 年 6 月 19 日
編集済み: dj1du 2022 年 6 月 19 日
It should look like in the attached image! The upper two plots for var1 and var2 should be represented by the first colorbar and the two bottom plots for var3 and var4 by the second one.

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

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2022 年 6 月 19 日
perhaps something like this:
figure(1)
cx_12 = [min(min(var1(:)),min(var2(:))),max(max(var1(:)),max(var2(:)))];
cx_34 = [min(min(var3(:)),min(var4(:))),max(max(var3(:)),max(var4(:)))];
set(gcf, 'Position', [100, 800, 1400, 300])
ha=tight_subplot(2,2,[0.08 0.05],[0.1 0.01],[0.0 0.1])
axes(ha(1))
trisurf(T,x,y,z,var1)
caxis(cx_12)
axes(ha(2))
trisurf(T,x,y,z,var2)
caxis(cx_12)
colorbar
axes(ha(3))
trisurf(T,x,y,z,var3)
caxis(cx_34)
axes(ha(4))
trisurf(T,x,y,z,var4)
caxis(cx_34)
colorbar
HTH
  2 件のコメント
dj1du
dj1du 2022 年 6 月 19 日
Thank's a lot! I tried your code and it works perfectly!
Bjorn Gustavsson
Bjorn Gustavsson 2022 年 6 月 20 日
Good. Happy that it helped.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by