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!