MATLAB Answers

Plotting the density of latitude and longitude points as a heat map on geographic data

34 views (last 30 days)
Alex Lojko
Alex Lojko on 23 Nov 2017
Answered: Sean de Wolski on 9 Jan 2020
Hello, I have tried posting this elsewhere with no luck.
In continuation with my project for plotting lightning over the territory of Poland, I would like to plot the density of latitude and longitude points. So, areas which have more latitude & longitude points over the territory will have a different colour to areas with less latitude & longitude points. Currently I am able to plot latitude and longitude on a map; however, I would like the plots to have different colours depending on their density on this map:
https://imgur.com/a/OqcGq
I have tried many approaches but I have not found anything that works for my case.
I have tried creating a heatmap of points using the hist3 command; whilst this creates a heatmat with respect to density of points. It is a square grid and I cannot transpose this onto my map. I also tried downloading some functions from mathsworks such as this one: https://uk.mathworks.com/matlabcentral/fileexchange/8577-scatplot This is the closest I have gotten to somewhat plotting what I want: https://imgur.com/a/hn9uc using the command: scatplot(perun10_16.longitude, perun10_16.latitude, 'circles') Unfortunately, I do not know of a way to transfer this graph as spatial data onto my map of Poland using command: h = worldmap([48 57], [13 26]) % S = shaperead('POL_adm0.shp', 'UseGeoCoords', true); geoshow(h, S, 'Facecolor',[0.5 0.8 0.7])
% hold on
scatplot(perun10_16.latitude, perun10_16.longitude, 'circles')
% perun10_16.latitude and longitude represents the month of october, 2016.
I am aware that simply slapping on the scatplot function onto my map is not enough to get my idea working. If there was also a way to import a polygon outline of the map of Poland onto the figure I have created, that would also be acceptable; however, I am not sure how to do that either.
I hope this is enough information to know what I am doing. Does anyone have any suggestions as to what I should try now?

  0 Comments

Sign in to comment.

Answers (2)

Joel Kuyper
Joel Kuyper on 9 Jan 2020
I am curious whether or not you already fixed this.
j.d.kuyper@student.tudelft.nl

  0 Comments

Sign in to comment.


Sean de Wolski
Sean de Wolski on 9 Jan 2020
Look at geodensityplot
https://www.mathworks.com/help/releases/R2019b/matlab/ref/geodensityplot.html

  0 Comments

Sign in to comment.

Sign in to answer this question.