Plotly - how to plot Cylinder?

I have a function plotting the cylinder, using matplotlib.


I am wondering how to do the same using plotly?

below is my matplotlib function of plotting cylinder:

        #function to plot the cylinder
        def _plotCylinder(self, ax, x, y, z, dx, dy, dz, color='red',mode=2):
            """ Auxiliary function to plot a Cylinder  """
            # plot the two circles above and below the cylinder
            p = Circle((x+dx/2,y+dy/2),radius=dx/2,color=color,ec='black')
            p2 = Circle((x+dx/2,y+dy/2),radius=dx/2,color=color,ec='black')
            ax.add_patch(p)
            ax.add_patch(p2)
            art3d.pathpatch_2d_to_3d(p, z=z, zdir="z")
            art3d.pathpatch_2d_to_3d(p2, z=z+dz, zdir="z")
            # plot a circle in the middle of the cylinder
            center_z = np.linspace(0, dz, 15)
            theta = np.linspace(0, 2*np.pi, 15)
            theta_grid, z_grid=np.meshgrid(theta, center_z)
            x_grid = dx / 2 * np.cos(theta_grid) + x + dx / 2
            y_grid = dy / 2 * np.sin(theta_grid) + y + dy / 2
            z_grid = z_grid + z
            ax.plot_surface(x_grid, y_grid, z_grid,shade=False,fc=color,ec='black',alpha=1,color=color)
    x,y,z = item.position
    [w,h,d] = item.getDimension()
    # plot item of cylinder
    self._plotCylinder(axGlob, float(x), float(y), float(z), float(w),float(h),float(d),color=color,mode=2)

Hi @jerry2021,
Please take a look at this answer by @empet Basic 3D Cylinders