Plotting Points on a Map

1 次查看(过去 30 天)
Thomas
Thomas 2014-3-4
编辑: dpb 2014-3-6
I am doing a study, which requires to create a plot showing rainfall totals on a map. How do I do this? I figured that if I was able to set the axis to latlon, then I could manually put on these points on to a plot and put the map as a background. My question though,is how do you do this? I don't even know where to start!
  2 个评论
dpb
dpb 2014-3-4
Firstly, do you have the Mapping Toolbox or have to do this from base Matlab? What form do you have data in for
a) drawing the map, and
b) the rainfall data?
Thomas
Thomas 2014-3-5
Just base Matlab
I have a base OS map saved as a jpeg and then rainfall data has been calculated in totals by Matlab already.

请先登录,再进行评论。

回答(1 个)

dpb
dpb 2014-3-5
编辑:dpb 2014-3-6
Well, I'm no image guru w/ Matlab, but the basic is simply to load the figure and then add on to it. You don't say exactly how you intend/want to display the rainfall data--
m=imread('usmap-physical.jpeg'); % use your file, obviously
image(m) % and display it
[nr,nc]=size(m); % the size of the image
Now the hard part will be to determine the locations of some points on the map that you can use as reference coordinates and then scale the locations of your data to that. It's just solving for the slope and intercept for the x- and y- axis lengths of the image but you do have to have some way of locating a known position.
Then, once that's done, compute the x,y coordinates in the scale image coordinates and convert the rainfall data to string...
rfstr=num2str(rf,'%.1f'); % NB: rf _MUST_ be column vector
hold on % don't wipe out the image, plot on top of it htxt=text(x,y,rfstr,'color','r','backgroundcolor',0.7*ones(1,3),'fontsize',8);
Then, you modify the axis labels or hide them or whatever to finish cleaning up the appearance as desired.

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by