Skip to content
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

Characteristic Curve - Job plot: Add items-argument for custom slicing #390

Merged
merged 8 commits into from
Mar 14, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. The format
- Add a new argument to pass a mesh for the dual regions in `FieldsMixed(mesh=None)`.
- Add quadrature and grad arguments to `RegionLagrange`.
- Add order attribute to `RegionLagrange`.
- Add items-argument for custom slicing of characteristic curve plots in `CharacteristicCurve.plot(items=None)`.

### Changed
- Enhance Domain integration in `IntegralForm`: Ensure C-contiguous arrays as `fun`-argument.
Expand Down
8 changes: 6 additions & 2 deletions src/felupe/mechanics/_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def plot(
fig=None,
ax=None,
linestyle=".-",
items=None,
**kwargs
):

Expand All @@ -90,8 +91,11 @@ def plot(
if y is None:
y = self.y

x = np.array(x)
y = np.array(y)
if items is None:
items = slice(None)

x = np.array(x)[items]
y = np.array(y)[items]

if gradient:
y = np.gradient(y, x[:, xaxis], edge_order=2, axis=0)
Expand Down