how to fill data in map
5 次查看(过去 30 天)
显示 更早的评论
sir i want to plot my own data in map.please help me. how will do this thing?thank you in advance.please sir help me.
3 个评论
Kelly Kearney
2014-5-28
Do you have the Mapping Toolbox? If not, I'd recommend m_map.
While GIS might be quicker (if you have access to it), you can make some pretty nice maps in Matlab too... but it takes some work, and you need to gather all the necessary data files.
回答(1 个)
Chad Greene
2014-5-29
I disagree with the comments above. If you have the Mapping Toolbox, it's only a couple of lines in Matlab. If you have gridded rainfall data rainfall corresponding to lat and lon matrices, it would look something like this:
worldmap('india')
pcolorm(lat,lon,rainfall)
You'll have to search the web for shapefiles or coordinates of political borders and rivers, then plot them using geoshow or plotm.
4 个评论
Chad Greene
2014-5-30
You'll have to be more specific about what data you have and what your goal is. You've given us some lat/lon coordinates, but you have not told us what they correspond to. Your data may correspond to LATxLONxTIME. You haven't told us much about your third dimension. It might be eight years of annual rainfall totals. Or perhaps the first slice is rainfall, the second slice is average temperature, third is population density--we have no way of knowing unless you tell us.
Note that a 20x22 map will not have the high resolution of the example you attached to your original question.
Also, type ver into the command line--it should tell you if you have the Mapping Toolbox.
LAT = [7.7042;
9.1050;
10.505;
11.9065;
13.3073;
14.7081;
16.1088;
17.5096;
18.9104;
20.3111;
21.7119;
23.1127;
24.5134;
25.9142;
27.3150;
28.7157;
30.1165;
31.5172;
32.9180;
34.3188;
35.7195;
37.1203];
LON = [68.9062;
70.3125;
71.7188;
73.1250;
74.5312;
75.9375;
77.3438;
78.7500;
80.1562;
81.5625;
82.9688;
84.3750;
85.7812;
87.1875;
88.5938;
90.0000;
91.4062;
92.8125;
94.2188;
95.6250];
SomeData = rand(20,22,8); % <- Some random data
Slice1 = SomeData(:,:,1); % <- PLOT ONLY THE FIRST SLICE
latgrid = repmat(LAT',20,1);
longrid = repmat(LON,1,22);
% If you do not have the mapping toolbox, do this:
pcolor(longrid,latgrid,Slice1)
xlabel('degrees longitude')
ylabel('degrees latitude')
shading flat
% If you do have the mapping toolbox, do this:
worldmap('india')
pcolorm(latgrid,longrid,Slice1)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!