How to plot a filled contour on a map plot?
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Alan Garger
le 23 Déc 2023
Commenté : Star Strider
le 24 Déc 2023
I'm working on a project where I need to plot a filled contour onto a map. Ideally, this contour plot would be partially transparent so that the map underneath can still be seen. I was previously having issues where matlab didn't like plotting the output from countourf onto a geomap, so I implemented the solution found here:
This, however, only gives the contour lines, and not the filled areas. I also tried using a mapplot, but I have other data that also needs to be on this figure and that didn't end up working.
Here is the function I used, getContourLineCoordinates:
and here is my current code:
geoscatter(points,"y","x","filled","MarkerFaceColor","#0000ff")
for m=1:length(shapes)
geoplot(shapes(m))
end
%plotting contour map from previous calculation
contdata = contourc(xrange,yrange,Ftotnorm',100);
cTbl = getContourLineCoordinates(contdata); % from the file exchange
% Plot contour lines
hold(ax,'on')
nContours = max(cTbl.Group);
colors = autumn(nContours);
for i = 1:nContours
gidx = cTbl.Group == i;
geoplot(ax, cTbl.Y(gidx), cTbl.X(gidx),'Color', colors(i,:)); % note: x & y switched
end
% Add colorbar
colormap("autumn")
colorbar(ax)
3 commentaires
Star Strider
le 24 Déc 2023
I delete my unaccepted answers. You don’t seem to have used my solution anyway.
Réponse acceptée
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!