Spherical Contour Filled SurfaceΒΆ

../../_images/filled_octa_cont1.png

Also see Edge to Edge Surface and Spherical Edge Filled Surface .

import numpy as np
import matplotlib.pyplot as plt
import s3dlib.surface as s3d

# 2. Setup and map surfaces .........................................
rez,lrez = 5,4

surface = s3d.SphericalSurface.platonic(rez,'octa')
line = surface.contourLines(0.65)  # default: spherical contours
fsurf = line.get_filled_surface(dist=0.33,coor='s',lrez=lrez)

fsurf.map_cmap_from_op( lambda c : s3d.SphericalSurface.coor_convert(c)[0],'inferno')

# 3. Construct figure, add surface, plot ............................

fig = plt.figure(figsize=plt.figaspect(1))
fig.text(0.975,0.975, str(surface)+'\n'+str(line)+'\n'+str(fsurf),
    ha='right', va='top', fontsize='smaller', multialignment='right')
ax = plt.axes(projection='3d', aspect='equal')
minmax = ( -0.5,0.5 )
ax.set(xlim=minmax, ylim=minmax, zlim=minmax )
ax.set_axis_off()

ax.add_collection(fsurf.shade(0.5,isAbs=True))

fig.tight_layout()
plt.show()