【发布时间】:2015-03-26 23:44:01
【问题描述】:
我有一个等高线图,其中包含从 -90 到 90 度的数据。现在我正在使用喷气机,所以我有一张看起来像这样的地图
我被要求更改颜色图,这样我就没有渐变,而是每 5 度都有一个固定的颜色(所以我相信 36 种颜色)。此外,我在考虑可能在区间 [5 10] 和 [-10 -5] 上使用相同的颜色,如果有意义的话,依此类推。
我的代码很长,因为我有很多数据要处理,但这只是其中的一部分,你可以看到我用什么函数来绘制这个
%%
x1=data(:,5); %x location
y1=data(:,16); %y location
z1=phi*90; %angle phi
z2=gamma*90; %angle gamma
n=300; precision of grid
%Create regular grid across data space
[X,Y] = meshgrid(linspace(min(x1),max(x1),n), linspace(min(y1),max(y1),n));
figure(3);
contourf(X,Y,griddata(x1,y1,z1,X,Y),100,'EdgeColor', 'None')
%title('Variation of In-plane angle \phi')
axis equal
axis ([0 8000 0 12000])
axis off
h=colorbar;
caxis([-90 90])
set(h, 'YTick', [-90:15:90])
有人知道如何创建这个颜色条吗? 干杯
【问题讨论】:
-
www.mathworks.com/help/matlab/ref/colormap.html,你想要的都在那里
-
谢谢,我刚刚看了,我想我知道该怎么做了
标签: matlab matlab-figure colorbar colormap contourf