import numpy as np
import matplotlib.pyplot as plt
import s3dlib.surface as s3d
#.. Platonic Solid Surfaces
# 1. Define functions to examine ....................................
# 2. Setup and map surfaces .........................................
rez=4
surfaceType = ['tetra','octa','icosa','','cube','dodeca']
# 3. Construct figure, add surfaces, and plot ......................
fig = plt.figure()
minmax = (-.67,.67)
for i,stgID in enumerate(surfaceType) :
ax = fig.add_subplot(231+i, projection='3d', aspect='equal')
ax.set(xlim=(-1, 1), ylim=(-1, 1), zlim=(-1, 1))
ax.set_axis_off()
ax.set(xlim=minmax, ylim=minmax, zlim=minmax)
ax.set_proj_type('ortho')
ax.view_init(20,-15)
if len(stgID) == 0 : continue
surface = s3d.SphericalSurface.platonic(rez,stgID)
surface.map_cmap_from_op( cmap='rainbow_r' )
ax.set_title(surface.name, fontsize='large')
ax.add_collection3d(surface.shade())
fig.tight_layout()
plt.show()