How to plot a filled contour on a map plot?
20 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Star Strider
2023 年 12 月 24 日
I delete my unaccepted answers. You don’t seem to have used my solution anyway.
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Contour Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!