How can I remove those contour lines outside the map?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
Image Analyst
el 3 de Abr. de 2023
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.
Ver también
Categorías
Más información sobre Contour Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!