differt.plotting.draw_mesh#
- draw_mesh(vertices, triangles, **kwargs)[source]#
Plot a 3D mesh made of triangles.
- Parameters:
vertices (
Real[ArrayLike, 'num_vertices 3']) – The array of triangle vertices.triangles (
Int[ArrayLike, 'num_triangles 3']) – The array of triangle indices.kwargs (
Any) –Keyword arguments passed to
Mesh,plot_trisurf, orMesh3d, depending on the backend.Important
If you pass some
face_colorskeyword argument, it will be passed to Plotly asfacecolorunless they were manually passed, in which case theface_colorsargument is ignored. Matplotlib does not currently support individual face colors, so this argument is ignored.
- Return type:
- Returns:
The resulting plot output.
Examples
The following example shows how to plot a pyramid mesh.
>>> from differt.plotting import draw_mesh >>> >>> vertices = np.array([ ... [0.0, 0.0, 0.0], ... [1.0, 0.0, 0.0], ... [1.0, 1.0, 0.0], ... [0.0, 1.0, 0.0], ... [0.5, 0.5, 1.0], ... ]) >>> triangles = np.array([ ... [0, 1, 2], ... [0, 2, 3], ... [0, 1, 4], ... [1, 2, 4], ... [2, 3, 4], ... [3, 0, 4], ... ]) >>> fig = draw_mesh(vertices, triangles, backend="plotly", opacity=0.5) >>> fig