Skip to content

Commit

Permalink
Merge pull request #390 from adtzlr/job-plot-add-items
Browse files Browse the repository at this point in the history
Characteristic Curve - Job plot: Add items-argument for custom slicing
  • Loading branch information
adtzlr authored Mar 14, 2023
2 parents b59fb1b + 4d58063 commit ae921ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit ae921ec

Please sign in to comment.