Main Content

Use Opacity and Transparency in Globe Displays

This example shows how to create an opaque surface over which you can display line and point data. This can be useful with Globe displays that depict 3-D objects. You can see into and through them as long as no opaque surfaces (e.g., patches or surfaces) obscure your view. This can be particularly disorienting for point and line data, because features on the back side of the world are reversed and can overlay features on the front side.

Create a figure, set up a Globe display, and draw a graticule in a light color, slightly raised from the surface. To ensure that the surface displays over the entire globe, set the Clipping property of the axes object to 'off'.

ax = axesm('globe');
ax.Clipping = 'off';
gridm('GLineStyle','-','Gcolor',[.8 .7 .6],'Galtitude',.02)

Load and plot the coast data in black, and set up a 3-D perspective. Use the Rotate 3D tool on the figure's toolbar to rotate the view. Note how confusing the display is because of its transparency.

load coastlines
axis off

Make a uniform 1-by-1-degree grid and create a raster referencing object for it.

base = zeros(180,360);
baseR = georefcells([-90 90],[0 360],size(base));

Render the grid onto the globe, color it copper, light it from camera right, and make the surface reflect more light. The copper surface effectively hides all lines on the back side of the globe.

copperColor = [0.62 0.38 0.24];
camlight right
material([.8 .9 .4])