# 3D-cilinder import matplotlib.pyplot as plt import numpy as np def data_for_cylinder_along_z (center_x, center_y, radius, height_z): z = np.linspace (-1, 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_x y_grid = radius * np.sin (theta_grid) + center_y return x_grid, y_grid, z_grid from mpl_toolkits.mplot3d import Axes3D fig = plt.figure (figsize = (8, 8)) ax = fig.add_subplot (111, projection = "3d") Xc, Yc, Zc = data_for_cylinder_along_z (0, 0, 1, 1) ax.plot_surface (Xc, Yc, Zc, alpha = 0.5, color = "orange") plt.show ()