Shaded Surface EdgesΒΆ

../../_images/shaded_edges.png

For lines (surface edges), shading is applied to darken lines aligned with the view direction. Line fading provides 3D emphasis of the front lines.

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

# Surface edge shading with fading

rez, vlen, minmax = 3, 0.7, (-.8,.8)
label = ['\nsurface edges','\nshaded surface edges' ]
fig = plt.figure(figsize=(8,4),facecolor='k')
for i in range(2) :
    ax = fig.add_subplot(121+i, projection='3d', aspect='equal',proj_type='ortho', facecolor='k')
    ax.set(xlim=minmax, ylim=minmax, zlim=minmax,
        xlabel='X', ylabel='Y', zlabel='Z')
    ax.set_title(label[i], c='w')
    ax.set_axis_off()

    surface = s3d.SphericalSurface.grid(20,30, 'r',color='w')
    edges = surface.edges
    if i==1 : edges.shade().fade() # use default direction & view

    ax.add_collection3d(edges)

fig.tight_layout()
plt.show()