フィルターのクリア

How can I remove those contour lines outside the map?

2 ビュー (過去 30 日間)
Behrooz Daneshian
Behrooz Daneshian 2023 年 4 月 3 日
コメント済み: Behrooz Daneshian 2023 年 4 月 4 日
Hello everyone.
Using the code below, I can plot contour lines outlining frost depth values across the Minnesota. As can be seen in the output figures, some contour lines are shown outside the Minnesota map. Would you please help me solve this issue? Indeed, I just want to have contour lines within the Minnesota state.
clear
close all
clc
load("saved_data.mat")
[lon,lat] = meshgrid(-97.24:0.1:-89.48,43.49:0.1:49.38);
for v = 1:(size(data, 2)-2)
figure
usamap("Minnesota")
states=readgeotable("usastatehi.shp");
row=states.Name=="Minnesota";
Minnesota=states(row,:);
geoshow(Minnesota)
textm(Minnesota.LabelLat,Minnesota.LabelLon,Minnesota.Name,"HorizontalAlignment","center")
I = scatteredInterpolant(data(:,[2 1]), data(:,v+2));
I.Method='linear';
I.ExtrapolationMethod='linear';
contourm(lat,lon,min(1,max(0,I(lon,lat))));
colorbar('Ticks',[0.1, 0.3, 0.5, 0.7, 0.9, 1], 'TickLabels',{'0.1','0.3','0.5','0.7','0.9','1'})
end

回答 (1 件)

Image Analyst
Image Analyst 2023 年 4 月 3 日
If you have (x,y) coordinates of the outline of the state, and a list of (x,y) coordinates you want to check, you can use inpolygon.

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by