Skip to content

Commit

Permalink
Added plot each to envelopes
Browse files Browse the repository at this point in the history
  • Loading branch information
ccaprani committed Oct 5, 2023
1 parent d25d926 commit 795a50b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
33 changes: 32 additions & 1 deletion docs/source/notebooks/envelopes.ipynb

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions src/pycba/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,14 @@ def augment(self, env: Envelopes):
self.Rmax = np.zeros((self.nsup, self.nres))
self.Rmin = np.zeros((self.nsup, self.nres))

def plot(self, **kwargs):
def plot(self, each=False, **kwargs):
"""
Plots the envelopes of bending and shear.
Parameters
----------
each : Boolean
Wether or not to show each BMD and SFD in the enveloping. The default is False
**kwargs : Dict
Matplotlib keyword arguments for plotting.
Expand All @@ -369,7 +371,7 @@ def plot(self, **kwargs):
raise ValueError("No results to display")

L = self.x[-1]

fig, axs = plt.subplots(2, 1, sharex=True, **kwargs)

ax = axs[0]
Expand All @@ -387,5 +389,10 @@ def plot(self, **kwargs):
ax.grid()
ax.set_ylabel("Shear Force (kN)")
ax.set_xlabel("Distance along beam (m)")

if each:
for res in self.vResults:
axs[0].plot(self.x, res.results.M, "r", lw=0.5)
axs[1].plot(self.x, res.results.V, "b", lw=0.5)

return fig, ax

0 comments on commit 795a50b

Please sign in to comment.