How can I have multiple colormaps in single map using mapping toolbox?

I have a map with pcolorm for nutrient depth (range 0-400m) and contourm for temperature (range 0-30 deg Celcius) contours. I would like to use two colormaps, 'winter' for nutrient depth and 'hot' for temperature. The image attached is almost correct, but I would like a range of color for the contour lines. The examples shown here haven't worked for the map axis: https://www.mathworks.com/matlabcentral/answers/101346-how-do-i-use-multiple-colormaps-in-a-single-figure
if true
% code
% data
[lon2,lat2] = meshgrid(60:.5:140,32:-.5:-32);
xq = lon2; yq = lat2;
x = NutMap(:,2); y = NutMap(:,1); v = NutMap(:,3);v2 = NutMap(:,4); %size(NutMap) = 129x161
vq = griddata(x,y,v,xq,yq,'linear');tq = griddata(x,y,v2,xq,yq,'linear');
vq(landmask(lat2,lon2))=NaN; tq(landmask(lat2,lon2))=NaN;
contourmin = min(min(tq));
contourmax = max(max(tq));
pcolormin = min(min(vq));
pcolormax = max(max(vq));
figure;
hf = worldmap([-32 32],[60 140]);
colormap(hAxesP,winter);
pcolorPlot = pcolorm(xq,yq,vq);
cbP = colorbar(hAxesP,'Location','west');
caxis(hAxesP,[pcolormin pcolormax]);
hAxesCM = gca;
axis(hAxesCM,'off')
colormap(hAxesCM,hot);
contourmPlot = contourm(xq,yq,tq,20);
cbCM = colorbar(hAxesCM,'Location','east');
caxis(hAxesCM,[contourmin contourmax]);
linkaxes([hAxesP,hAxesCM]);
geoshow('landareas.shp', 'FaceColor', 'black');
end

2 commentaires

If I can assist by editing the question with sample data, or clarifying anything, I can do so.
Still a great and unanswered question! Someone pls help :(

Connectez-vous pour commenter.

Réponses (1)

Give freezecolors a try, it has solved similar problems before, though not completely without fail.
HTH

Catégories

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by