Skip to content

Commit

Permalink
Use the new DpfPlotter instead of the old.
Browse files Browse the repository at this point in the history
  • Loading branch information
PProfizi committed Aug 11, 2022
1 parent 3dac2e2 commit 8abdec8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ansys/dpf/post/result_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,16 +340,25 @@ def plot_contour(

# If not plotting on a path
else:
# Try and use the new DpfPlotter from PyDPF-Core
try:
from ansys.dpf.core.plotter import DpfPlotter as DpfPlotterObj
except:
raise dpf_errors.CoreVersionError(version='0.3.4')
# Initialize a Plotter
pl = DpfPlotter(self._evaluator._model.metadata.meshed_region, **kwargs)
pl = DpfPlotterObj(**kwargs)
# Create an equivalent field container
if len(self.result_fields_container) == 1:
fc = self.result_fields_container
else:
# sorts and creates a new fields_container with only the desired labels
fc = self._sort_fields_container_with_labels(option_id, display_option)
# Call Plotter.plot_contour (to change for use of DpfPlotter
pl.plot_contour(fc, **kwargs)
# pl.plot_contour(fc, **kwargs)
pl.add_mesh(self._evaluator._model.metadata.meshed_region)
for field in fc:
pl.add_field(field)
pl.show_figure(**kwargs)

def _plot_chart(self):
"""Plot the minimum/maximum result values over time.
Expand Down

0 comments on commit 8abdec8

Please sign in to comment.