# Plot data on sphere/world map

26 views (last 30 days)
Heiko on 17 Apr 2013
Hello all!
I have a dense set of 2D points on a sphere (theta,phi). For each of those points, I have an observation (obs). I can convert the points to 3D Cartesian points and then do a scatter plot of the observations
scatter3(x,y,z,1,obs);
This generates an image which looks like this. http://herrstrathmann.de/files/world.png
What I would like to have an interpolated version of the data and a surface plot. For this I somehow need to interpolate the 2D coordinates into a grid. The current scatter plot looks a bit ugly. I have tried the following code which however creates artefacts on the edges. After all, the sphere is periodic. How can I interpolate nicely?
p=linspace(min(theta)+1, max(theta)-1);
q=linspace(min(phi)+1, max(phi)-1);
[p,q]=meshgrid(p,q);
obs_interp=griddata(theta,phi,obs,p,q);
Once I have the inteprolated data, how do I plot it onto the surface of the sphere in a nice way?
On top of all that, I would like to plot the world map. Is that somehow possible? I can align it myself once I know how it basically works
Many thanks for your help! Heiko

Angus on 11 Jun 2013
Im not sure if you need to interpolate at all ... you have a 2d matrix of data with associated vectors for phi and theta? Then you should be able to display it as is using the mapping toolbox.
Lets say you had
theta = [-179:180];
phi = [-89:90];
obs % 360x180 2d array of data
[lat_grid,lon_grid] = meshgrid(theta,phi); % should both be 360x180 to match data
load coast % loads lat and long variables that define the coastline
worldmap('World') % also try axesm as it gives more options
geoshow(lat,long) % draw the coastlines
pcolorm(lat_grid,lon_grid,obs) % a pseudo-color plot of obs data on the projected grid
Hope that helps (alternately, hope you found a solution already)
Cheers, Angus