Globe display issue - need opaque sub-surface
3 次查看(过去 30 天)
显示 更早的评论
I'm trying to plot data on a 3D globe with the Mapping Toolbox, and I've encountered the following issue.
When plotting on another map projection like 'ortho,' I can turn on the frame and set its color, and then overlay shapes like the following:
axesm('MapProjection','ortho','Frame','on','Grid','on','FFaceColor',...
[190 208 233]/255,'MeridianLabel','off','ParallelLabel','off','Geoid',...
referenceEllipsoid('wgs84'),'Origin',[0,0,0])
land = shaperead('landareas','UseGeoCoords',true);
geoshow(land,'FaceColor',[245 237 220]/255)
tightmap
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195063/image.png)
I want to do this for a 3D globe, but it seems that since 'globe' is not an actual map projection, it doesn't have a frame for which I can set a background color. Thus, when I overlay my data, you can see right through the globe in between the shapes:
axesm('globe','Frame','on','Grid','on','FFaceColor',[190 208 233]/255,...
'MeridianLabel','off','ParallelLabel','off','Geoid',...
referenceEllipsoid('wgs84'))
land = shaperead('landareas.shp','UseGeoCoords',true);
geoshow(land,'FaceColor',[245 237 220]/255)
view(3)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195065/image.png)
How can I add an opaque background layer to a globe?
0 个评论
回答(1 个)
Chad Greene
2019-3-8
For the globe functions in the Climate Data Toolbox for Matlab I had to include one called globefill, for that very purpose. If you want to stick the Mapping Toolbox functions, you might be able to plot a regular white sphere like this:
[X,Y,Z] = sphere(N);
h = surf(X*radius,Y*radius,Z*radius,'facecolor',color,'edgecolor','none');
To determine the radius, plot the globe as you have already done, then type xlim or ylim to get the limits of the axes. I don't have Matlab with me right now, but I'm guessing it will be in the range of 0.5 or something. Tinker with the value of the radius until you get a white sphere inside the globe, not too big, and not too small.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!