Plotter#

class ansys.dpf.core.plotter.Plotter(mesh, **kwargs)#

Plots fields and meshed regions in DPF-Core.

Deprecated since version 0.17.0: This class is deprecated. Use DpfPlotter instead (see DpfPlotter.add_field() and DpfPlotter.add_fields_container()).

Parameters:

mesh (str) – Name of the mesh.

Overview#

plot_mesh

Plot the mesh using PyVista.

plot_contour

Plot the contour result on its mesh support.

plot_chart

Plot the minimum/maximum result values over time.

Import detail#

from ansys.dpf.core.plotter import Plotter

Method detail#

Plotter.plot_mesh(**kwargs)#

Plot the mesh using PyVista.

Deprecated since version 0.17.0: Plotter is deprecated. Use DpfPlotter instead.

Parameters:
  • notebook (bool, optional) – 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.

  • **kwargs (optional) – Additional keyword arguments for the plotter. For more information, ee help(pyvista.plot).

static Plotter.plot_chart(fields_container, off_screen=False, screenshot=None)#

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.

Deprecated since version 0.17.0: Use the module-level ansys.dpf.core.plotter.plot_chart() instead.

Parameters:
  • fields_container (dpf.core.FieldsContainer) – Fields container that must contain a result for each time step of time_freq_support.

  • off_screen (bool, optional) – Used to prevent the figure from showing in a pop-up, useful for batch image generation. Defaults to False.

  • screenshot (str, os.pathLike, optional) – 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.

Plotter.plot_contour(field_or_fields_container: ansys.dpf.core.field.Field | ansys.dpf.core.fields_container.FieldsContainer, shell_layers: ansys.dpf.core.common.shell_layers = None, meshed_region: ansys.dpf.core.meshed_region.MeshedRegion = None, deform_by: ansys.dpf.core.field.Field | ansys.dpf.core.Result | ansys.dpf.core.Operator = None, scale_factor: float = 1.0, **kwargs)#

Plot the contour result on its mesh support.

You cannot plot a fields container containing results at several time steps. Use FieldsContainer.animate() instead.

Deprecated since version 0.17.0: Plotter is deprecated. Use DpfPlotter instead.

Parameters:
  • field_or_fields_container – Field or field container that contains the result to plot.

  • shell_layers – Enum used to set the shell layers if the model to plot contains shell elements. Defaults to the top layer.

  • meshed_region – Mesh to plot the data on.

  • deform_by – Used to deform the plotted mesh. Must output a 3D vector field.

  • scale_factor – Scaling factor to apply when warping the mesh.

  • **kwargs – Additional keyword arguments for the plotter. For more information, see help(pyvista.plot).