Skip to content

Commit efb87f9

Browse files
committed
Correct pyvista plotter implementation.
1 parent 7f9e7f6 commit efb87f9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/ansys/fluent/visualization/plotter/abstract_plotter_defns.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def plot(self, data: dict) -> None:
4040
"""
4141
pass
4242

43+
@abstractmethod
44+
def show(self):
45+
pass
46+
4347
@abstractmethod
4448
def close(self):
4549
"""Close plotter window."""

src/ansys/fluent/visualization/plotter/pyvista/plotter_defns.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __init__(
7878
self.chart = None
7979
self.plotter = None
8080

81-
def plot(self, data: dict) -> None:
81+
def plot(self, data: dict, grid=(1, 1), position=(0, 0), **kwargs) -> None:
8282
"""Draw plot in window.
8383
8484
Parameters
@@ -102,8 +102,12 @@ def plot(self, data: dict) -> None:
102102
self._max_x = max(self._max_x, max_x_value) if self._max_x else max_x_value
103103

104104
if not self._remote_process:
105-
self.plotter = pv.Plotter(title=f"PyFluent [{self._window_id}]")
105+
if self.plotter is None:
106+
self.plotter = pv.Plotter(
107+
title=f"PyFluent [{self._window_id}]", shape=grid
108+
)
106109
self.chart = pv.Chart2D()
110+
self.plotter.subplot(position[0], position[1])
107111
self.plotter.add_chart(self.chart)
108112
self.chart.title = self._title
109113
self.chart.x_label = self._xlabel or ""
@@ -128,6 +132,7 @@ def plot(self, data: dict) -> None:
128132
y_range = 0
129133
self.chart.y_range = [self._min_y - y_range * 0.2, self._max_y + y_range * 0.2]
130134

135+
def show(self):
131136
if not self._visible:
132137
self._visible = True
133138
self.plotter.show()

0 commit comments

Comments
 (0)