我想将两个数据集的等高线图放在同一轴上,并使用相同的颜色条。数据的X和Y范围不重叠,但物理上相邻。
以下是两个这样的contourf图的简化示例,我想将它们组合在同一轴上:
%generate 1st sample dataset
[x1,y1]=meshgrid(-3:3);
v1=peaks(x1,y1)
%generate 2nd sample dataset & move it so it is physically adjacent to
%1st dataset
[x2,y2]=meshgrid(-4:4);
v2=peaks(x2,y2)
x2=8+x2;
figure(1)
contourf(x1,y1,v1)
colormap(jet)
colorbar('EastOutside')
xlabel('x (mm)')
ylabel('y (mm)')
figure(2)
contourf(x2,y2,v2)
colormap(jet)
colorbar('EastOutside')
xlabel('x (mm)')
ylabel('y (mm)')
这会生成以下图表
我尝试使用以下方法将两个样本数据集放在同一轴上:
figure(3)
contourf(x1,y1,v1)
colormap(jet)
hold on
contourf(x2,y2,v2)
colormap(jet)
hold off
使用典型的“保持”不起作用...建议??
答案 0 :(得分:0)
第二个等高线图是不可见的,因为x轴限制太小。在hold off
xlim([-3 12]);
ylim([-4 4]);
这将产生以下情节