mymesh.visualize.View#

mymesh.visualize.View(M, interactive=True, bgcolor=None, color=None, face_alpha=1, color_convert=None, clim=None, theme='default', scalar_preference='nodes', view='iso', scalars=None, show_edges=False, show_faces=True, line_width=1, line_color=None, return_image=False, hide=False, shading='flat')[source]#

Visualize a mesh. View uses vispy for visualization.

Parameters:
  • M (mymesh.mesh) – Mesh object to be viewed

  • interactive (bool, optional) – View mesh in an interactive window, allowing for panning, rotation, etc. By default True.

  • bgcolor (_type_, optional) – _description_, by default None

  • color (str, array_like, or NoneType, optional) – Color of the surface, specified as a named color (see ParseColor(), hex color code, or RGBA list/tuple/array). If None, the color will be chosen based on the theme, by default None.

  • face_alpha (Float, optional) – Alpha value controlling face opacity - 0 = transparent, 1 = opaque, by default 1.

  • color_convert (str or NoneType, optional) – Convert the colors to simulate different types of color vision. Available options are “deuteranomaly”, “protanomaly”, “tritanomaly”, or “grayscale”, by default None. Color conversion is performed using Colorspacious

  • clim (tuple or NoneType, optional) – Color range bounds if displaying scalar data, by default None.

  • theme (str, optional) – Select a theme (see GetTheme()), by default ‘default’.

  • scalar_preference (str, optional) – In the even that scalars is specified by a string that references an entry in both M.NodeData and M.ElemData, this will decide which is chosen. Specified as either ‘nodes’ or ‘elements’, by default ‘nodes’.

  • view (str, optional) –

    Named orientation for viewing the mesh, by default ‘iso’

    Options are:

    • ”iso” or “isometric” : isometric view

    • ”dimetric” : dimetric view

    • ”trimetric” : trimetric view

    • ”xy” : View of the x-y plane with +x to the right and +y up

    • ”xz” : View of the x-z plane with +x to the right and +z ups

  • scalars (str, array_like, or None, optional) – Scalar values to color the mesh by. If specified by a string, the string should be an entry in either M.NodeData or M.ElemData. If the string is present in both, scalar_preference will be used determine whether node or element data will be displayed (node by default). If specified by an array_like (numpy ndarray or list), the length of the array_like most be equal to either the number of nodes or the number of elements in the mesh. If None, the mesh will be given a solid color following color. By default None.

  • show_edges (bool, optional) – Show lines denoting element edges. For a wireframe view, set show_edges=True, show_faces=False, by default False.

  • show_faces (bool, optional) – Show element faces in the mesh. For a wireframe view, set show_edges=True, show_faces=False, by default True

  • line_width (int, optional) – Width of lines shown if show_edges=True, by default 1

  • line_color (None, optional) – Color of edges shown if show_edges=True, by default None. If None, color will be selected based on theme.

  • return_image (bool, optional) – If true, image array of the plot will be returned, by default False

  • hide (bool, optional) – If true, plot will not be shown, by default False

  • shading (str, optional) – Shading mode, by default ‘flat’ Options are ‘flat’, ‘smooth’, None

Returns:

img_data – Image array of the plot. Only returned if return_image=True.

Return type:

np.ndarray, optional