pysdic.Plotter3D.add_mesh#
- Plotter3D.add_mesh(mesh, *, warp_by=None, vertex_color=None, vertex_size=None, vertex_opacity=None, vertex_mask=None, show_vertices=True, edge_color=None, edge_width=None, edge_opacity=None, show_edges=True, face_color=None, face_opacity=None, face_mask=None, show_faces=True, vertex_property=None, element_property=None, property_axis=None, property_clim=None, property_cmap=None, property_below_color=None, property_above_color=None, texture=None, texture_rgb=True, show_bar=False, bar=None, vertex_vectors=None, element_vectors=None, vector_scale=1.0, vector_color=None, show_vertices_index=False, show_elements_index=False, vertex_index_color='black', element_index_color='blue', index_font_size=10)[source]#
Add a mesh to the plotter (only for \(E \leq 3\), the missing coordinates are set to 0).
The element type of the mesh must be set. The faces (elements) are displayed if they are selected by
face_maskand all their vertices are finite (after warping). The vertices are displayed if they are selected byvertex_maskand finite.Note
The faces are displayed with duplicated vertices (one copy per element), so that each element can have its own texture coordinates.
- Parameters:
mesh (
pysdic.Mesh) – The mesh to display.warp_by (Optional[Union[str, ArrayLike]], optional) – The displacement added to the vertices: the name of a vertex property or an array, of shape \((N_v, E)\).
vertex_color (Optional[Union[str, Tuple[Real, Real, Real]]], optional) – The color of the vertices: a color name (e.g.
"red"), an RGB tuple or a hex string.vertex_size (Optional[Real], optional) – The size of the vertices (positive). PyVista default:
5.0.vertex_opacity (Optional[Real], optional) – The opacity of the vertices, between
0.0and1.0. PyVista default:1.0.vertex_mask (Optional[ArrayLike], optional) – A boolean array of shape \((N_v,)\), True for the vertices to display. By default, all the finite vertices are displayed. The faces are not affected.
show_vertices (bool, optional (default:
True)) – Whether to show the vertices.edge_color (Optional[Union[str, Tuple[Real, Real, Real]]], optional) – The color of the edges.
edge_width (Optional[Real], optional) – The width of the edges (positive). PyVista default:
1.0.edge_opacity (Optional[Real], optional) – The opacity of the edges, between
0.0and1.0. PyVista default:1.0.show_edges (bool, optional (default:
True)) – Whether to show the edges of the displayed faces.face_color (Optional[Union[str, Tuple[Real, Real, Real]]], optional) – The color of the faces. Ignored if a property or a texture is given.
face_opacity (Optional[Real], optional) – The opacity of the faces, between
0.0and1.0. PyVista default:1.0.face_mask (Optional[ArrayLike], optional) – A boolean array of shape \((N_e,)\), True for the faces to display. By default, all the faces with finite vertices are displayed.
show_faces (bool, optional (default:
True)) – Whether to show the faces.vertex_property (Optional[Union[str, ArrayLike]], optional) – The property used to color the faces (interpolated between the vertices): the name of a vertex property, or an array of shape \((N_v,)\) or \((N_v, A)\) (for all the vertices).
element_property (Optional[Union[str, ArrayLike]], optional) – The property used to color the faces (one color per face): the name of an element property, or an array of shape \((N_e,)\) or \((N_e, A)\) (for all the elements). Ignored if
vertex_propertyis given.property_axis (Optional[Integral], optional) – The component used for coloring when the property has \(A > 1\) components, in \([0, A)\). By default, the norm of the property vector is used.
property_clim (Optional[Tuple[Real, Real]], optional) – The color limits (min, max). By default, they are set automatically.
property_cmap (Optional[Union[str,
matplotlib.colors.Colormap]], optional) – The colormap (name or object). Matplotlib default:"viridis".property_below_color (Optional[Union[str, Tuple[Real, Real, Real]]], optional) – The color of the values below
property_clim. By default, the first color of the colormap.property_above_color (Optional[Union[str, Tuple[Real, Real, Real]]], optional) – The color of the values above
property_clim. By default, the last color of the colormap.texture (Optional[ArrayLike], optional) – An image used as texture, of shape \((H, W)\), \((H, W, 1)\) (gray levels), \((H, W, 3)\) or \((H, W, 4)\) (RGB or RGBA). Only for surface meshes with a UV map (see
pysdic.Mesh.uvmap).texture_rgb (bool, optional (default:
True)) – If False, an RGB or RGBA texture is converted to gray levels.show_bar (bool, optional (default:
False)) – Whether to show the color bar when a property is given.bar (Optional[Dict[str, Any]], optional) – The keyword arguments of
add_scalar_bar()whenshow_baris True.vertex_vectors (Optional[Union[str, ArrayLike]], optional) – A vector field drawn as arrows from the vertices selected by
vertex_mask(even ifshow_verticesis False): the name of a vertex property or an array, of shape \((N_v, 3)\) or \((N_v, E)\).element_vectors (Optional[Union[str, ArrayLike]], optional) – A vector field drawn as arrows from the centers of the elements selected by
face_mask(seepysdic.Mesh.compute_elements_centers()): the name of an element property or an array, of shape \((N_e, 3)\) or \((N_e, E)\). Only one ofvertex_vectorsandelement_vectorscan be given.vector_scale (Union[Real, ArrayLike], optional (default:
1.0)) – The scale factor of the arrows (strictly positive and finite): an arrow has the length of its vector times its scale. A scalar for all the arrows, or a 1D array with one value per row of the vector field: \(N_v\) forvertex_vectorsor \(N_e\) forelement_vectors.vector_color (Optional[Union[str, Tuple[Real, Real, Real]]], optional) – The color of the arrows of the vector fields. Default is set by PyVista.
show_vertices_index (bool, optional (default:
False)) – Whether to write the index of each vertex selected byvertex_masknext to it (even ifshow_verticesis False).show_elements_index (bool, optional (default:
False)) – Whether to write the index of each element selected byface_maskat its center (seepysdic.Mesh.compute_elements_centers()), even ifshow_facesis False.vertex_index_color (Optional[Union[str, Tuple[Real, Real, Real]]], optional (default:
"black")) – The color of the indices of the vertices.element_index_color (Optional[Union[str, Tuple[Real, Real, Real]]], optional (default:
"blue")) – The color of the indices of the elements.index_font_size (Real, optional (default:
10)) – The font size of the indices, in pixels of the screen (strictly positive): the labels keep their size when zooming.
- Raises:
TypeError – If
meshis not apysdic.Mesh.ValueError – If the mesh is empty or has no element type, if \(E > 3\), if an input has a wrong shape, if a texture is given without UV map, or if nothing can be displayed.
IndexError – If
property_axisis out of range.
- Return type:
None