How can I have multiple colormaps in single map using mapping toolbox?
Show older comments
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 Comments
Cathy Garcia
on 16 Sep 2016
Irish Matt
on 12 May 2019
Still a great and unanswered question! Someone pls help :(
Answers (1)
Bjorn Gustavsson
on 13 May 2019
0 votes
HTH
Categories
Find more on Orange in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!