You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code should show a cylinder that is on a plane. However, as obvious in the 3rd and the 4th image, the shading and layering of matplotlib are not applied correctly and the result looks strange. Using zorder didn't also solve that.
Code for reproduction
importmatplotlib.pyplotaspltimportnumpyasnpfrommpl_toolkits.mplot3dimportAxes3D# Help function to determine the cylinder plot datadefdata_for_cylinder_along_z(center_x,center_y,center_z,radius,height_z):
z=np.linspace(0, height_z, 50)
theta=np.linspace(0, 2*np.pi, 50)
theta_grid, z_grid=np.meshgrid(theta, z)
x_grid=radius*np.cos(theta_grid) +center_xy_grid=radius*np.sin(theta_grid) +center_yz_grid=z_grid-height_z/2+center_zreturnx_grid,y_grid,z_grid# setting up a figurefig=plt.figure(figsize=(10, 10))
ax=fig.gca(projection='3d')
ax.view_init(90, 0)
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
ax.set_xlim3d(-1, 1)
ax.set_ylim3d(-1, 1)
ax.set_zlim3d(-1, 1)
# plotting a planeyy, zz=np.meshgrid([-0.5, 0.5], [-0.5, 0.5])
ax.plot_surface(0, yy, zz, color='yellow')
# plotting a cylinderr=0.1Xc,Yc,Zc=data_for_cylinder_along_z(r, 0, 0, r, 1)
ax.plot_surface(Xc, Yc, Zc)
plt.show()
Actual outcome
Expected outcome
The plane should be behind the cylinder in all images and the cylinder must be shown.
Bug report
The following code should show a cylinder that is on a plane. However, as obvious in the 3rd and the 4th image, the shading and layering of
matplotlib
are not applied correctly and the result looks strange. Usingzorder
didn't also solve that.Code for reproduction
Actual outcome
Expected outcome
The plane should be behind the cylinder in all images and the cylinder must be shown.
Matplotlib version
print(matplotlib.get_backend())
): Qt5AggThe text was updated successfully, but these errors were encountered: