多子图
多个pcolor或contourf只显示一个colorbar
用axes定义坐标轴位置来实现,如果只对某一个subplot显示colorbar,会有图像大小不一致的问题。
demo:
top_margin = 0.04;
btm_margin = 0.06;
left_margin = 0.06;
right_margin = 0.08;
fig_margin = 0.05;
row = 3;
col = 2;
clim = [-1 16];
fig_height = (1- top_margin - btm_margin - (row-1) * fig_margin) / row;
fig_width = (1 - left_margin - right_margin - (col-1) * fig_margin) / col;
figure
count=0;
for i = 1 : row
for j = 1 : col
position = [left_margin + (j-1)*(fig_margin+fig_width),...
1- (top_margin + i * fig_height + (i-1) * fig_margin), fig_width, fig_height];
axes('position', position);
count=count+1;
pcolor(magic(coun