график концентрации морского льда на цветной карте белого цвета

У меня есть файл nc с lat, lon и ice_conc. Я хочу отобразить концентрацию морского льда на квадратной сетке (что и делает сценарий) в оттенках белого вместо желтого, а открытый океан - в синем. Вот что у меня есть:

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])

введите здесь описание изображения


person Bacol    schedule 16.04.2021    source источник
comment
Создайте новую карту цветов!   -  person Ander Biguri    schedule 16.04.2021


Ответы (1)


Одним из способов было бы создать свою собственную карту цветов. Ниже приведен возможный пример:

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
person Matteo V    schedule 16.04.2021
comment
Спасибо, Маттео, это именно то, что мне нужно! - person Bacol; 07.05.2021
comment
Не забудьте принять ответ, если это то, что вам нужно. - person Matteo V; 07.05.2021