Plot data on sphere/world map
조회 수: 43 (최근 30일)
이전 댓글 표시
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);
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
댓글 수: 0
답변 (1개)
Angus
2013년 6월 11일
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!