fedoo.ProblemDataSet.plot

ProblemDataSet.plot(field: str | None = None, component: int | str = 0, data_type: str | None = None, scale: float = 1, show: bool = True, show_edges: bool = True, clim: list[float] | None = None, node_labels: bool | list = False, element_labels: bool | list = False, show_nodes: bool | float = False, show_normals: bool | float = False, plotter: object | None = None, screenshot: str | None = None, azimuth: float = 30.0, elevation: float = 15.0, roll: float = 0, title: str | None = None, title_size: float = 18.0, window_size: list | None = None, multiplot: bool | None = None, element_set: str | ndarray[int] | None = None, element_set_invert: bool = False, selected_submeshes=None, clip_args: tuple | None = None, lock_view: bool = False, iteration: int | None = None, show_local_frame: bool | float = False, local_frame_axis=None, local_frame_options=None, **kargs) → None

Plot a field on the surface of the associated mesh.

Parameters:
  • field (str (optional)) – The name of the field to plot. If no name is given, plot only the mesh.

  • component (int | str, default = 0) –

    The data component to plot in case of vector data. The available str components are:

    • ’X’, ‘Y’ and ‘Z’; respectively equivalent to 0, 1 and 2 for vector components.

    • ’XX’, ‘YY’, ‘ZZ’, ‘XY’, ‘XZ’ and ‘YZ’ are respectively equivalent to 0, 1, 2, 3, 4 and 5 for tensor using the voigt notations.

    • ’vm’ to plot the von-mises stress from a stress field.

    • ’pressure’ to extract the hydrostatic pressure of a stress field.

    • ’norm’ to compute the vector euclidean norm.

  • data_type (str in {'Node', 'Element', 'GaussPoint'} - Optional) – The type of data to plot (defined at nodes, elements au gauss integration points). If the existing data doesn’t match to the specified one, the data are converted before plotted. For instance data_type = ‘Node’ make en average of data from adjacent elements at nodes. This allow a more smooth plot. It the type is not specified, look for any type of data and, if the data is found, draw the field without conversion.

  • scale (float, default = 1) – The scale factor used for the nodes displacement, using the ‘Disp’ vector field. If scale = 0, the field is plotted on the underformed shape.

  • show (bool, default = True) –

    • If show = True, the plot is rendered in a new window.

    • If show = False, the current pyvista plotter is returned without rendering.

    • show = False allow to customize the plot with pyvista before rendering it.

  • show_edges (bool, default = True) – if True, the mesh edges are shown

  • clim (sequence[float], optional) – Sequence of two float to define data boundaries for color bar. Defaults to minimum and maximum of data.

  • node_labels (bool | list, default = False) – If True, show node labels (node indexe) If a list is given, print the label given in node_labels[i] for each node i.

  • element_labels (bool | list, default = False) – If True, show element labels (element indexe) If a list is given, print the label given in element_labels[i] for each element i.

  • show_nodes (bool|float, default = False) – Plot the nodes. If True, the nodes are shown with a default size. If float, show_nodes is the required size.

  • show_normals (bool or float, default=False) – Display geometric normals independently of the selected frame field. True uses an arrow length of 2% of the mesh bounding-box diagonal; a number supplies the percentage. Uses axis 3 for surfaces in 3D and axis 2 for lines in 2D. Other mesh types are skipped. When show_local_frame is also enabled, the local-frame display takes precedence. The local_frame_options settings also apply to normals.

  • plotter (pyvista.Plotter object or str in {'qt', 'pv'}) –

    • If pyvista.Plotter object, plot the mesh in the given plotter

    • If ‘qt’: use the background plotter of pyvistaqt (need the lib pyvistaqt)

    • If ‘pv’: use the standard pyvista plotter

    • If None: use the background plotter if available, or pyvista plotter if not.

  • screenshot (str, optional) – If defined, indicated a filename to save the plot.

  • azimuth (float, default = 30.) – Azimuth angle of the camera around the scene (not used for 2D scene)

  • elevation (float, default = 15.) – Elevaltion angle of the camera around the scene (not used for 2D scene).

  • roll (float, default = 0) – Roll angle of the camera. The default state (roll angle = 0.) is set with the y direction on the up.

  • title (str | None, default = None) – Title of the plot. By default the title is field name and the component is printed.

  • title_size (float, default = 18) – Size of the title

  • window_size (tuple, default = (1024, 768)) – Window size in pixels.

  • multiplot (bool | None, default = None) – If True, the pyvista mesh is copied to force a separated scalar bar. This is usefull when ploting several figures at the same time. If multiplot si False, the same scalarbar will be applied to all the plots. If None, uses separated scalarbars only if the pyvista plotter uses subplot.

  • element_set (str or array[int], optional) – Name of an element set associated to the mesh (str), or list of element set indices. If specified, plot only the given elements or hide the element set if element_set_invert == True.

  • element_set_invert (bool, optional) – Used only if element_set is defined. Invert element set.

  • selected_submeshes (int, str or list, optional) – Only used with MultiMesh objects. Restrict the plot to the selected submesh ids, submesh names or element types.

  • missing_field_color (color, optional) – Only used with MultiMesh objects. Render submeshes on which the selected element or Gauss-point field is absent with this solid color. By default, submeshes missing the field are not plotted.

  • show_local_frame (bool or float, default=False) – Display frame arrows independently of the scalar field and component. False hides arrows. True uses 2% of the mesh bounding-box diagonal; a nonnegative number specifies that percentage (1.0 means 1%). Select the frame with set_current_local_frame(); the default selection None uses saved frames or the supported geometric fallback separately for each submesh. Scalar colours are not transformed.

  • local_frame_axis (int, sequence of int or None, default=None) – One-based axes: 1, 2 or 3, or a sequence such as [1, 3]. None displays all axes: two in a 2D space, three in 3D. Explicit axis 3 in 2D raises ValueError. For geometric shell frames, axis 3 is the normal; for lines in 2D, axis 2 is the normal.

  • local_frame_options (dict or None, default=None) –

    Optional display settings (omitted entries use these defaults):

    • max_frames=1000: maximum frame count, sampled across the visible locations of all selected submeshes.

    • gauss_points=False: for Gauss-point fields, draw one frame at each element centre using its first GP orientation. True displays the GP positions and orientations; geometric fallback frames use the default element quadrature. Nodal fields remain at nodes.

    • legend=False: show the local-axis colour legend when True.

    These settings affect display only; visibility masks, clipping and deformation also apply to the overlay. Unknown option names are rejected when the overlay is enabled.

  • clip_args (dict, optional) – Dictionary of arguments to pass to the pyvista clip filter in order to clip the current plot. If clip_args[“cell_ids”] exist and is set to True, the “cell_ids” array is passed to the pyvista mesh to track the original element IDs in the clipped mesh.

  • lock_view (bool, default = False) – If True, the camera position and background color are not modified. In this mode, any view‑modifying arguments such as azimuth, elevation, or roll are ignored.

  • iteration (int, optional) – ignored if the object is not a MultiFrameDataSet. Index of the iteration to plot. If None, the current iteration is plotted. If no current iteration is defined, the last iteration is loaded and plotted.

  • shell_thickness (bool, default = False) – Display the saved shell section thickness for tri3/quad4 surfaces along deformed midsurface normals. The selected field is repeated through the thickness, without extra section recovery. Other element types and submeshes without saved shell section metadata keep their original geometry.

  • **kwargs (dict) – See pyvista.Plotter.add_mesh() in the document of pyvista for additional usefull options.

Examples

Overlay the third axis of a selected shell frame on von Mises stress:

>>> data.set_current_local_frame("ShellLocalFrame")
>>> data.plot(field="Stress", component="vm", show_local_frame=2.0,
...           local_frame_axis=3)

Restore automatic selection, showing all axes with fewer samples:

>>> data.set_current_local_frame(None)
>>> data.plot(show_local_frame=True,
...           local_frame_options={"max_frames": 200, "legend": True})

A normal overlay always uses geometry; a scalar frame component remains an ordinary colour plot:

>>> data.plot(field="Stress", component="vm", show_normals=2.0)
>>> data.plot(field="_ShellLocalFrame", component="XX")

Notes

If the package pyvistaqt is installed, the BackgroundPlotter is used by default. To desactivate pyvistaqt, set the fedoo config:

>>> fedoo.get_config()['USE_PYVISTA_QT'] = False