Skip to content

Commit a8c63cb

Browse files
authored
Allow kwargs arguments for simulation.plot() (#446)
1 parent 3171050 commit a8c63cb

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/ansys/dpf/post/simulation.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def plot(
205205
constructed_geometries: bool = True,
206206
loads: bool = True,
207207
boundary_conditions: bool = True,
208+
**kwargs,
208209
):
209210
"""General plot of the simulation object.
210211
@@ -223,6 +224,9 @@ def plot(
223224
Whether to plot the loads.
224225
boundary_conditions:
225226
Whether to plot the boundary conditions.
227+
**kwargs
228+
Additional keyword arguments for the plotter. More information
229+
are available at :func:`pyvista.plot`.
226230
227231
Returns
228232
-------
@@ -237,15 +241,15 @@ def plot(
237241
"""
238242
plt = DpfPlotter()
239243
if mesh:
240-
plt.add_mesh(self.mesh._meshed_region)
244+
plt.add_mesh(self.mesh._meshed_region, **kwargs)
241245
if constructed_geometries:
242246
for geom in self.geometries:
243-
getattr(plt, "add_" + str(type(geom).__name__).lower())(geom)
247+
getattr(plt, "add_" + str(type(geom).__name__).lower())(geom, **kwargs)
244248
if loads:
245249
pass
246250
if boundary_conditions:
247251
pass
248-
plt.show_figure()
252+
plt.show_figure(**kwargs)
249253

250254
@property
251255
def active_selection(self) -> Union[Selection, None]:

tests/test_simulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_simulation_active_selection(static_simulation):
9696

9797

9898
def test_simulation_plot(static_simulation):
99-
static_simulation.plot()
99+
static_simulation.plot(cpos="xy")
100100

101101

102102
def test_simulation_split_mesh_by_properties(allkindofcomplexity):

0 commit comments

Comments
 (0)