フィルターのクリア

How can I plot two colorbars in isosurface figure?

4 ビュー (過去 30 日間)
Nayoung Kim
Nayoung Kim 2016 年 10 月 25 日
コメント済み: Nayoung Kim 2016 年 10 月 26 日
I want to plot two isosurface in one figure :Z1,Z2
isovalues1 = 0:0.1:1;
for i=1:length(isovalues1)
isosurface(X,Y,Z,Z1,isovalues1(i));
end
hc(1,1)=colorbar;
hc(1,1).Limits = [0 1];
hold on
ax = gca;
isovalues2 = 40:10:100;
for i=1:length(isovalues2)
isosurface(X,Y,Z,Z2,isovalues2(i));
end
hc(1,2)=colorbar;
hc(1,2).Limits = [40 100];
I don't know why this does not work properly. colorbar ranges are [0 1], [40 100] but they shows only one colorbar limits [0 100] How can I fix it?

採用された回答

Walter Roberson
Walter Roberson 2016 年 10 月 25 日
You need to hold after the first isosurface for each axes
Each axes can have only one colorbar
  3 件のコメント
Walter Roberson
Walter Roberson 2016 年 10 月 25 日
See for example:
isovalues1 = 0:0.1:1;
isovalues2 = 40:10:100;
[X,Y,Z] = meshgrid(isovalues1);
Z1 = X + sin(Y) + Z.^2;
Z2 = (cos(X) + Y + sqrt(Z)) * 50;
subplot(1,2,1);
for i = 1 : length(isovalues1); isosurface(X,Y,Z,Z1,isovalues1(i)); hold on; end; hold off
view(8,71);
hc(1,1)=colorbar;
hc(1,1).Limits = [0, 1];
subplot(1,2,2);
for i = 1 : length(isovalues2); isosurface(X,Y,Z,Z2,isovalues2(i)); hold on; end; hold off
hc(1,2)=colorbar;
hc(1,2).Limits = [40, 100];
view(8,71);
Nayoung Kim
Nayoung Kim 2016 年 10 月 26 日
I want to overlap two figures. and see cross section.
isovalues1 = 0:0.1:1;
for i=1:length(isovalues1)
isosurface(X,Y,Z,Z1,isovalues1(i));
end
ax(1)=gca;
hc(1,1)=colorbar;
hc(1,1).Limits = [0 1];
ax(2)=axes;
set(gca, 'Color', 'none')
view(3)
isovalues2 = 40:10:100;
for i=1:length(isovalues2)
isosurface(X,Y,Z,Z2,isovalues2(i));
end
alpha(.5)
set(ax(2), 'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none');
hc(1,2)=colorbar;
hc(1,2).Limits = [40 100];
but when I plot figures like above, second figure is just plotted on the first figure. How can I fix it?

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by