Plot data on a global map

22 views (last 30 days)
Thishan Dharshana
Thishan Dharshana on 12 Feb 2023
Answered: Walter Roberson on 13 Feb 2023
Hello,
I have 3D matrix of size (360,180,300). I need to plot this on a global map. 360 represents longitudes, 180 represents latitudes and 300 represents temperature at each coordinate. I can use the following to draw the map boundaries.
worldmap('world')
load coastlines
plotm(coastlat,coastlon)
Please help me with this plotting.

Answers (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 12 Feb 2023
(1) Load your data
(2) Plot world map
(3) Hold on the plot figure
(4) plot your data on top of the world map. E.g.:
worldmap('world')
load coastlines
% World map plotted
plotm(coastlat,coastlon)
% Plot is held
hold on
% Load your data:
% E.g.:
X = coastlat(1:1800);
Y = coastlon(1:1800);
% Your data plotted on the top of the world map:
plotm(X, Y, 'r--', 'LineWidth',2)

Walter Roberson
Walter Roberson on 13 Feb 2023
As discussed in https://www.mathworks.com/matlabcentral/answers/1910990-global-map-based-on-data-from-a-3d-matrix#answer_1169590 you have the problem that you have multiple datapoints (12 in that discussion, 300 here) for each latitude and longitude combination.
The suggestions I gave there:
  • draw one plot for each layer of data; or
  • contour each layer of data with hold on and a different color of line. This might be difficult to understand
Otherwise, you need to start considering doing some kind of volume visualization, which might be a bit tricky to overlay on a map. You could try something like volshow or https://www.mathworks.com/help/images/ref/volumeviewer-app.html but those will not overlay on a map. And volume visualization is... difficult... to understand unless you are looking at something like isosurfaces of equal rainfail.

Community Treasure Hunt

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

Start Hunting!