フィルターのクリア

Contour controls in geoshow

18 ビュー (過去 30 日間)
Peter
Peter 2020 年 5 月 25 日
回答済み: sid Chen 2023 年 1 月 20 日
Simple question (I hope) for experienced Matlab people. But the Matlab help is no help, at least I've been unable to find it. I think I lack a generic understanding of plot control. There's a bunch of help under: https://au.mathworks.com/help/matlab/contour-plots-1.html and https://au.mathworks.com/help/matlab/ref/contour.html but I can't apply it to maps. Maybe I'm making a mistake. Maybe it's not possible.
Reading Matlab help for contours in general plots I find examples like this:
Z = peaks;
figure
[C,h] = contour(Z,8);
clabel(C,h)
====
Then the contours can be customized, using the handles(? I don't really understand handles) C & h.
But I'm using geoshow. I was doing a color plot:
geoshow(newLat, newLon, pavrainData(:,:,i)', 'DisplayType','surface') % plot % values
colormap (flipud(parula))
colorbar
caxis([camin1 camax1]) % set colorbar axis
====
In that case I have control of the scale using colormap, and caxis and that's working fine. But I want to use contours instead *and* control which contour lines are displayed, e.g 0 50 100 150 200.
1. I tried to grab handles but that doesn't work:
[C,h]=geoshow(newLat, newLon, pavrainData(:,:,i)', 'DisplayType','contour'); % plot % values
clabel(C,h)
2. I tried to include the set contours in the geoshow command (trying similar syntax to the contour command) but that doesn't work:
geoshow(newLat, newLon, pavrainData(:,:,i)', 'DisplayType','contour',[0 50 100 150 200])
Really appreciate if someone can give me guidance - is the first method (ie #1) the correct approach, or the second (#2)? Or another way? And what's the correct syntax?
Basically I just want to plot set contour lines on a map from one variable.
Thanks!

回答 (1 件)

sid Chen
sid Chen 2023 年 1 月 20 日
you can try
levels = [0 50 100 150 200];
contourm(newLat, newLon, pavrainData(:,:,i)',levels)
% Map is raster
% geoR is GeographicCellsReference
the syntax of contourm is same to contour.
hope that can help you.

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by