Skip to content

feat(geometry): propagate kwargs in geometry plot methods #2251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/06-plotting/07-plot_on_geometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@

###############################################################################
# Show points together with the mesh
points.plot(mesh, cpos=cpos)
points.plot(mesh, cpos=cpos, point_size=15, color="blue")

###############################################################################
# Create line passing through the geometry's diagonal:
line = Line([[0.03, 0.03, 0.05], [0.0, 0.06, 0.0]], n_points=50)

###############################################################################
# Show line with the 3D mesh
line.plot(mesh, cpos=cpos)
line.plot(mesh, cpos=cpos, color="black")

###############################################################################
# Create vertical plane passing through the mid point:
Expand All @@ -104,7 +104,7 @@

###############################################################################
# Show plane with the 3D mesh
plane.plot(mesh, cpos=cpos)
plane.plot(mesh, cpos=cpos, color="red")

###############################################################################
# Map displacement field to geometry objects
Expand Down
6 changes: 3 additions & 3 deletions src/ansys/dpf/core/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"""Visualize Points object. If provided, ``mesh`` will be also plotted."""
cpos = kwargs.pop("cpos", None)
pl = DpfPlotter(**kwargs)
pl.add_points(self._coordinates.data, render_points_as_spheres=True, point_size=10)
pl.add_points(self._coordinates.data, render_points_as_spheres=True, **kwargs)

Check warning on line 118 in src/ansys/dpf/core/geometry.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/geometry.py#L118

Added line #L118 was not covered by tests
if mesh:
pl.add_mesh(mesh, style="surface", show_edges=True, color="w", opacity=0.3)
pl.show_figure(show_axes=True, cpos=cpos)
Expand Down Expand Up @@ -246,7 +246,7 @@

# Plot line object
pl = DpfPlotter(**kwargs)
pl.add_line(self._coordinates.data, width=5)
pl.add_line(self._coordinates.data, **kwargs)

Check warning on line 249 in src/ansys/dpf/core/geometry.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/geometry.py#L249

Added line #L249 was not covered by tests
if mesh:
pl.add_mesh(mesh, style="surface", show_edges=True, color="w", opacity=0.3)
pl.show_figure(show_axes=True, cpos=cpos)
Expand Down Expand Up @@ -448,7 +448,7 @@

# Plot plane object
pl = DpfPlotter(**kwargs)
pl.add_plane(self)
pl.add_plane(self, **kwargs)

Check warning on line 451 in src/ansys/dpf/core/geometry.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/geometry.py#L451

Added line #L451 was not covered by tests
if mesh:
pl.add_mesh(mesh, style="surface", show_edges=True, color="w", opacity=0.3)
pl.show_figure(show_axes=True, cpos=cpos)
Expand Down
Loading