plot heat map on map using Latitude, Longitude and my data value

Hi,
i have a number of locations across Europe (lat,lon), and for each one i have a corresponding value (in a form of a vector). I would like to create a heatmap using the mapping toolbox such that the a circle is drawn around each lat/lon, with the colour of these circles being defined based on the value my vector.
a simple example is as follows:
figure(1);
f=worldmap([33 68],[-15 37]);
geoshow('landareas.shp', 'FaceColor', [1 1 1],'DefaultEdgeColor', 'b')
PointLatLon = [51 -2.3;54 -3.2;50 3.9;51 5.5;48 1.1];
mValue = [1 4 2 7 3];
plotm(PointLatLon(:,1),PointLatLon(:,2),'r.');
There is a code by Chad Greene which i can use to generate the circles (attached), but i don't know how to specify the colour in a heatmap form. the code for the circle can be found at: http://www.mathworks.com/matlabcentral/fileexchange/48122-circlem
Any help is much appreciated.

 採用された回答

Amy Haskins
Amy Haskins 2015 年 12 月 29 日
編集済み: Amy Haskins 2015 年 12 月 29 日

1 投票

I think that scatterm will work nicely. It would look something like this:
markerSize = 50;
scatterm(PointLatLon(:,1), PointLatLon(:,2), markerSize, mValue,'Filled');
colorbar
The colors will be chosen from the current colormap based on the value. You can use the colormap command or the figure's colormap editor to change the color coding scheme.

6 件のコメント

Amir
Amir 2016 年 1 月 5 日
Thanks Amy, Maybe i should have mentioned this in the original question, but i would like to draw a circle at each point for a specific radius. in this case, i would like each circle to be 90km in radius. Any work around for this?
Thanks
Amy Haskins
Amy Haskins 2016 年 1 月 8 日
If you want to be able to specify the size of the circles in distance units, then you would need to use something more like the circlem function that Arnab suggested. The scircle1 function in the Mapping Toolbox will give you the coordinates of the circles. You can use geoshow with the desired face color to plot them.
As far as deciding on the colors, I assumed below that the values are all positive integers. I made a colormap with a number of colors equal to the maximum value. When I plot the circles I pick my color using the value as an index into my list of colors.
If the values were not all positive integers, you would have do to a little more work to map each value to an index in the color map.
colors = jet(max(mValue));
for index = 1:length(mValue)
[latc,longc] = scircle1(PointLatLon(index,1),PointLatLon(index,2),90,[],earthRadius('km'));
geoshow(latc,longc,'DisplayType','polygon','FaceColor',colors(mValue(index),:))
end
Amir
Amir 2016 年 1 月 25 日
Thanks Amy! Exactly what i was looking for :)
Poulomi Ganguli
Poulomi Ganguli 2018 年 1 月 10 日
Hello, I was following this post for a while and this is really helpful. Just a question, how to put a colorbar in this case?
Amir
Amir 2018 年 1 月 11 日
Hi Poulomi, If you follow the method proposed by Amy to plot the circles, you can then get the colorbar as follows:
colormap(colors);
set(gca, 'CLim', [0, max(mValue)]);
colorbar;
Poulomi Ganguli
Poulomi Ganguli 2018 年 1 月 12 日
yea. Thanks! I tried something like that.. now its working :).

サインインしてコメントする。

その他の回答 (2 件)

Arnab Sen
Arnab Sen 2015 年 12 月 29 日

1 投票

I understand that you would like to put color for the circles created on the map. You can do this by sending 'facecolor' as an argument to the 'circlem' function. For example, you may call the function with the arguments as following MATLAB code snippet:
>> h = circlem(lats(1),lons(1),500,'facecolor','red');
For complete documentation of 'circlem', refer to the following link:

1 件のコメント

Amir
Amir 2016 年 1 月 5 日
Thanks Arnab, sending the 'facecolor' as an argument does color each circle, but i would like to color each one using the value of 'mValue' in a heatmap form.

サインインしてコメントする。

Jack
Jack 2018 年 1 月 12 日

0 投票

Hi, this looks exactly what I need. However, is it possible to plot it on top of a google map? I am looking at data at much smaller spatial scales - towns and cities, rather than the world map in the example shown here.
Thank you

1 件のコメント

Poulomi Ganguli
Poulomi Ganguli 2018 年 1 月 16 日
In that case, you have to read shapefile of your town/cities & repeat the above.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeColor and Styling についてさらに検索

質問済み:

2015 年 12 月 11 日

コメント済み:

2018 年 1 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by