赞
踩
1:请问matlab中画多张图如何使用同一范围的colorbar?
例如生成了图1,2,3
生成图1时,使用
temp1=caxis;
将图1的z值的取值范围(即colorbar的取值范围)取出。
生成图2,3时
使用
caxis(temp1)
命令将图2,3的z值的取值范围设为同1相同。
然后对各个同使用colorbar命令便可以了。
解释:matlab将z值映射到colormap,colorbar通过z值和colormap的映射关系生成的,所以需要
将不同的figure,z值映射相同的colormap索引。
命令:
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 r
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。