:class:`Plotter` ================ .. py:class:: ansys.dpf.core.plotter.Plotter(mesh, **kwargs) Plots fields and meshed regions in DPF-Core. :param mesh: Name of the mesh. :type mesh: str .. py:currentmodule:: Plotter Overview -------- .. tab-set:: .. tab-item:: Methods .. list-table:: :header-rows: 0 :widths: auto * - :py:attr:`~plot_mesh` - Plot the mesh using PyVista. * - :py:attr:`~plot_contour` - Plot the contour result on its mesh support. .. tab-item:: Static methods .. list-table:: :header-rows: 0 :widths: auto * - :py:attr:`~plot_chart` - Plot the minimum/maximum result values over time. Import detail ------------- .. code-block:: python from ansys.dpf.core.plotter import Plotter Method detail ------------- .. py:method:: plot_mesh(**kwargs) Plot the mesh using PyVista. :param notebook: When ``None`` (default) plot a static image within an iPython notebook if available. When ``False``, plot external to the notebook with an interactive window. When ``True``, always plot within a notebook. :type notebook: bool, optional :param \*\*kwargs: Additional keyword arguments for the plotter. For more information, ee ``help(pyvista.plot)``. :type \*\*kwargs: optional .. py:method:: plot_chart(fields_container, off_screen=False, screenshot=None) :staticmethod: Plot the minimum/maximum result values over time. This is a valid method if ``time_freq_support`` contains several time steps, such as in a transient analysis. :param fields_container: Fields container that must contain a result for each time step of ``time_freq_support``. :type fields_container: dpf.core.FieldsContainer :param off_screen: Used to prevent the figure from showing in a pop-up, useful for batch image generation. Defaults to False. :type off_screen: bool, optional :param screenshot: Path to save the figure to. Defaults to None. If no extension is given, defaults to .png format. See ``help(matplotlib.pyplot.savefig)`` for more information on supported formats. :type screenshot: str, os.pathLike, optional .. rubric:: Examples >>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_simple_bar()) >>> disp = model.results.displacement() >>> scoping = dpf.Scoping() >>> scoping.ids = range(1, len(model.metadata.time_freq_support.time_frequencies) + 1) >>> disp.inputs.time_scoping.connect(scoping) >>> fc = disp.outputs.fields_container() >>> plotter = dpf.plotter.Plotter(model.metadata.meshed_region) >>> pl = plotter.plot_chart(fc) .. py:method:: plot_contour(field_or_fields_container, shell_layers=None, meshed_region=None, deform_by=None, scale_factor=1.0, **kwargs) Plot the contour result on its mesh support. You cannot plot a fields container containing results at several time steps. :param field_or_fields_container: Field or field container that contains the result to plot. :type field_or_fields_container: dpf.core.Field or dpf.core.FieldsContainer :param shell_layers: Enum used to set the shell layers if the model to plot contains shell elements. :type shell_layers: core.shell_layers, optional :param deform_by: Used to deform the plotted mesh. Must output a 3D vector field. Defaults to None. :type deform_by: Field, Result, Operator, optional :param scale_factor: Scaling factor to apply when warping the mesh. Defaults to 1.0. :type scale_factor: float, optional :param \*\*kwargs: Additional keyword arguments for the plotter. For more information, see ``help(pyvista.plot)``. :type \*\*kwargs: optional