Skip to content

Commit cdf0a38

Browse files
Add argument to skip showing pyvista plot (#4452)
1 parent 0ac994a commit cdf0a38

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pyaedt/generic/plot.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,14 +1516,19 @@ def __call__(self, state):
15161516
)
15171517

15181518
@pyaedt_function_handler()
1519-
def plot(self, export_image_path=None):
1519+
def plot(self, export_image_path=None, show=True):
15201520
"""Plot the current available Data. With `s` key a screenshot is saved in export_image_path or in tempdir.
15211521
15221522
Parameters
15231523
----------
15241524
1525-
export_image_path : str
1526-
Path to image to save.
1525+
export_image_path : str, optional
1526+
Path to image to save. Default is None
1527+
show : bool, optional
1528+
Whether to display the pyvista plot.
1529+
When False, a :class::pyvista.Plotter object is created
1530+
and assigned to the pv property so that it can be
1531+
modified further. Default is True.
15271532
15281533
Returns
15291534
-------
@@ -1645,9 +1650,9 @@ def s_callback(): # pragma: no cover
16451650
self.pv.add_key_event("s", s_callback)
16461651
if export_image_path:
16471652
self.pv.show(screenshot=export_image_path, full_screen=True)
1648-
elif self.is_notebook: # pragma: no cover
1653+
elif show and self.is_notebook: # pragma: no cover
16491654
self.pv.show() # pragma: no cover
1650-
else:
1655+
elif show:
16511656
self.pv.show(full_screen=True) # pragma: no cover
16521657

16531658
self.image_file = export_image_path

0 commit comments

Comments
 (0)