Plot interpolated contours of map data.
조회 수: 1 (최근 30일)
이전 댓글 표시
I am attempting to plot contours for rainfall data using scattered data points.
I have created a base map for Europe and fitted a shapefile with the international boundaries. This loads up fine and works perfectly for plotting locations as points on the map.
I am now trying to produce contours on this map based on rainfall values at the specific locations. I have three variables: Latitude and Longitude determine the location and Z is the rainfall value. The data points are unevenly spaced.
I have created a grid and have tried using numerous matlab functions including TriScatteredInterp, Interp2, and other triangulation techniques such as Delaunay,to interpolate values within the grid so that I can plot the contours. The code I am using takes the basic form:
[LatGrid, LonGrid] = meshgrid(min(latitude):.2:max(latitude),... min(longitude):.2:max(longitude));
F = griddata(latitude, longitude, Z(:,1), LatGrid, LonGrid,'nearest');
contourm(LatGrid,LonGrid,F, 0:0.5:4, 'LineWidth',2);
I don't get an error it just fails to display correctly, as shown below:
Any help explaining what is going on would be greatly appreciated.
As an aside why does latitude come before longitude when plotting the data as technically longitude represents the x-axis? I have looked at numerous examples and tried changing the order of latitude and longitude in the command lines but the results produced are the same.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!