1:请问matlab中画多张图如何使用同一范围的colorbar?
例如生成了图1,2,3
生成图1时,使用
temp1=caxis;
将图1的z值的取值范围(即colorbar的取值范围)取出。
生成图2,3时
使用
caxis(temp1)
命令将图2,3的z值的取值范围设为同1相同。
然后对各个同使用colorbar命令便可以了。
example
:
subplot(4,6,19); mim(ang90ind10);temp1=caxis;
subplot(4,6,20) ;
mim(ang90ind11);caxis(temp1);
subplot(4,6,21) ;
mim(ang90ind12);caxis(temp1);
subplot(4,6,22) ;
mim(ang90ind13);caxis(temp1);
subplot(4,6,23); mim(ang90ind14);caxis(temp1);
subplot(4,6,24) ;
mim(ang90ind15);caxis(temp1);
subplot(4,6,13) ;
mim(ang60ind10);caxis(temp1);
subplot(4,6,14) ;
mim(ang60ind11);caxis(temp1);
subplot(4,6,15) ;
mim(ang60ind12);caxis(temp1);
subplot(4,6,16) ;
mim(ang60ind13);caxis(temp1);
subplot(4,6,17) ;
mim(ang60ind14);caxis(temp1);
subplot(4,6,18) ;
mim(ang60ind15);caxis(temp1);
subplot(4,6,7) ;
mim(ang30ind10); caxis(temp1);
subplot(4,6,8); mim(ang30ind11); caxis(temp1);
subplot(4,6,9) ;
mim(ang30ind12);caxis(temp1);
subplot(4,6,10) ;
mim(ang30ind13);caxis(temp1);
subplot(4,6,11) ;
mim(ang30ind14);caxis(temp1);
subplot(4,6,12) ;
mim(ang30ind15);caxis(temp1);
subplot(4,6,1); mim(ang00ind10); caxis(temp1);
subplot(4,6,2); mim(ang00ind11);caxis(temp1);
subplot(4,6,3) ;
mim(ang00ind12);caxis(temp1);
subplot(4,6,4) ;
mim(ang00ind13);caxis(temp1);
subplot(4,6,5);
mim(ang00ind14);caxis(temp1);
subplot(4,6,6) ;
mim(ang00ind15);caxis(temp1);
命令:
caxis
caxis([cmin cmax])
caxis controls the mapping of data values to the
colormap.
2:colorbar的刻度经常达不到极值,可以使用下面的方法达到极值
figure
[x,y,z]=peaks(20);
subplot(2,1,1),contourf(x,y,z),colorbar
subplot(2,1,2),contourf(x,y,z)
t1=caxis;
t1=linspace(t1(1),t1(2),6);
my_handle=colorbar('ytick',t1);
再比如:
load topo
subplot('position',[0 0.5 1 0.45 ])
axesm robinson
meshm(topo,topolegend)
demcmap(caxis)
h=colorbar('northoutside');
t=get(h,'xtick');
subplot('position',[0 0.05 1 0.45 ])
axesm robinson
meshm(topo,topolegend)
a=caxis;
demcmap(caxis)
colorbar('northoutside','xtick',[a(1),t,a(2)])