如何解决在彩色地图白色中绘制海冰浓度
我有一个包含 lat、lon 和 ice_conc 的 nc 文件。我希望以白色而不是黄色的阴影在方形网格(脚本所做的)上绘制海冰浓度,并将开阔的海洋绘制为蓝色。这是我所拥有的:
silo=ncread('ice_conc_201707031200_v2.nc','lon');
sila=ncread('ice_conc_201707031200_v2.nc','lat');
si=ncread('ice_conc_201707031200_v2.nc','ice_conc');
F = scatteredInterpolant(silo',sila',si');
[lox,lay] = meshgrid(-80:0.05:80,-70:0.05:-20);
sii = F(lox,lay);
sii(isnan(sii))=0;
set(groot,'defaultAxesTickLabelInterpreter','latex');
set(groot,'defaulttextinterpreter','latex');
set(groot,'defaultLegendInterpreter','latex');
close all
ax1 = axes;
contourf(ax1,lox,lay,sii/100,'LineColor','none'); % do I plot colormap in white for 100% seaice down
to blue for 0% sea ice??
grid on,axis equal,xlim([10 50]),ylim([-70 -30])
解决方法
一种方法是创建自己的颜色图。下面是一个可能的例子:
cmap = colormap(); % your current colormap
n = size(cmap,1)/2; % change only the second half of the colormap
col = cmap(n,:); % color at the halfway point
for i = 1:3
% For example linearly interpolate the color between the one at the halfway point and white
cmap(n:end,i) = linspace(col(i),1,length(cmap(n:end,i)));
end
contourf(...) % your plot
colormap(cmap) % apply the colormap
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。