There is a cylinder
x=np.linspace(-1, 1, 100) z=np.linspace(0, 1, 100) Xc, Zc=np.meshgrid(x, z) Yc = np.sqrt(1-Xc**2) rstride = 20 cstride = 10 ax.plot_surface(Xc, Yc, Zc, alpha=0.2,linewidth=0) ax.plot_surface(Xc, -Yc, Zc, alpha=0.2,linewidth=0) There is also a list of points that need to be repainted. How can this be done? Maybe there is a suitable function?
Found an opportunity to paint, but for some reason the back side of the cylinder is incorrectly painted
import math from matplotlib import pyplot as plt from mpl_toolkits.mplot3d.art3d import Poly3DCollection, Line3DCollection import numpy as np from matplotlib.colors import LightSource fig = plt.figure() ax = fig.add_subplot(111, projection='3d') #Построение цилиндра x=np.linspace(-1, 1, 100) z=np.linspace(0, 1, 100) Xc, Zc=np.meshgrid(x, z) Yc = np.sqrt(1-Xc**2) ############################ # Create light source object. ls = LightSource(azdeg=0, altdeg=65) # Shade data, creating an rgb array. rgb = ls.shade(Yc, plt.cm.RdYlBu) ############################ rstride = 20 cstride = 10 ax.plot_surface(Xc, Yc, Zc,facecolors=rgb, alpha=0.9,linewidth=0) ax.plot_surface(Xc, -Yc, Zc,facecolors=rgb, alpha=0.9,linewidth=0) ax.set_xlabel("X") ax.set_ylabel("Y") ax.set_zlabel("Z") plt.show()