Overlaying scatter points over world map in MATLAB

1.8k Views Asked by At

I am facing difficulty overlaying lightning location data over a region of the world map.

I have lightning location data where the first column contains longitude and the second column latitude.

I would like to plot these lightning locations as points over a region of the world defined by latitudes 0 to 40 S and longitudes 135 E to 120 W.

2

There are 2 best solutions below

0
On

The following code provides the desired graphs:

% extract coordinates
data = December; % suppose the coordinates are stored in the variable December
longitude_E = getcolumn(data(1:size(data),:),1);
latitude_N = getcolumn(data(1:size(data),:),2);

% load boundry data
load coast
m_proj('mercator','long',[135 240],'lat',[-40 0]);
axesm('MapProjection','mercator','MapLatLimit',[-40 0],'MapLonLimit',[135 240]);

framem
m_coast('patch',[0.7 0.7 0.7]);
m_grid('box','fancy','tickdir','in');

h=plotm(latitude_N,longitude_E,'.b','MarkerSize',5');

% display boundry information
hp = plotm(lat,long,'k');
set(hp,'LineWidth',2.0);



The figure obtained is

enter image description here

0
On

Wow this was an old question. You probably have solved it already. Anyway here is one approach.

So it seems to me you have a set of point estimates. One point measured per strike? If that is the case and you have very many points as it looks on your figure, you would do better to do some integral approximated density sampling over some grid

 % The following will give you :
 [xs,ys] = meshgrid(linspace(x_min,x_max,Nx),linspace(x_min,x_max,Ny));

And then you do a pairwise distance calculation between each strike point and each grid point and assign the nearest neighbor to each and sum them up. Depending on sizes of dimensions you may need to add up multiple passes in a loop. In that case, Matlab would tell you this as an out of memory error something of the sort.