from matplotlib import pyplot as plt
from matplotlib import cm
import s3dlib.surface as s3d
#.. Earth Elevation Contour Projection
# 2. Setup and map surfaces .........................................
rez, lrez = 5, 5
earth = s3d.SphericalSurface(rez,color='k')
earth.map_geom_from_image('data/elevation.png',1)
elev = earth.contourLines(1.1,coor=2)
surface = elev.get_filled_surface(coor='s',dist=0.05,lrez=lrez)
surface.map_cmap_from_op( lambda c : s3d.SphericalSurface.coor_convert(c,False)[0] , 'jet')
# 3. Construct figure, add surfaces, and plot ......................
fig = plt.figure(figsize=plt.figaspect(1), facecolor='black' )
fig.text(0.02,0.02,str(surface), ha='left', va='bottom',
fontsize='smaller', color='white')
ax = plt.axes(projection='3d', aspect='equal')
ax.set_title('Elevation Contour Projection',color='w')
minmax = (-0.80,0.80)
ax.set(xlim=minmax, ylim=minmax, zlim=minmax)
ax.set_facecolor('black')
ax.set_axis_off()
ax.view_init(25,-150)
ax.add_collection3d(surface)
fig.tight_layout(pad=1)
plt.show()