How to plot a filled contour on a map plot?
显示 更早的评论
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 个评论
Dyuman Joshi
2023-12-23
Without the data, it is not possible to see the current output of the code nor to suggest anything.
Please attach the data you are working with, use the paperclip button to do so.
Alan Garger
2023-12-23
Star Strider
2023-12-24
I delete my unaccepted answers. You don’t seem to have used my solution anyway.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
