2012-11-27 78 views
1

我在等值线图上绘制0到10的z值。在MATLAB中绘制等值线图上的零值

当我包含数据1或更大时,我会得到一个等值线图。如下所示:

longitude = [80 82 95] 
latitude = [30 32 35] 
temp = [1 4 6; 1 2 7; 3 5 7] 

contourf(longitude,latitude,temp) 

现在,我想在等值线图上绘制零值。虽然我期待一种颜色代表零值,但我却获得了一个白色方块。

longitude = [80 82 95] 
latitude = [30 32 35] 
temp = [0 0 0; 0 0 0; 0 0 0] 

contourf(longitude,latitude,temp) 

非常感谢, 阿曼达

+1

不知道你在找什么;第二段代码尝试绘制平坦曲面的轮廓。这自然是未定义的(轮廓的边缘在哪里?)。 – Isaac

回答

1

正如伊萨克提及。在contourf中绘制常量数据是不可能的。

当您尝试这样做,你将获得从MATLAB这样的警告:

temp = 
    0  0  0 
    0  0  0 
    0  0  0 

    Warning: Contour not rendered for constant ZData 
    > In contourf>parseargs at 458 
    In contourf at 63 
    In TESTrandom at 45 

但是,如果你把一些数字为0,contourf正常工作:

longitude = [80 82 95]; 
latitude = [30 32 35]; 
temp = [0 4 6; 1 0 7; 0 5 9]; 

contourf(longitude,latitude,temp); 
hcb = colorbar('horiz');  % colour bar 
set(get(hcb,'Xlabel'),'String','Contourf Bar.') 

contourf produced by the code above