Skip to content

Commit a5f0f3c

Browse files
committed
Add method to plot KRM shapes
1 parent b706d84 commit a5f0f3c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/echosms/krmdata.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ class KRMorganism():
8585
source: str
8686
body: KRMshape
8787
inclusions: List[KRMshape]
88+
89+
def plot(self):
90+
"""Simple plot of organism shape."""
91+
92+
import matplotlib.pyplot as plt
93+
plt.plot(self.body.x, self.body.z_U, self.body.x, self.body.z_L, c='black')
94+
for s in self.inclusions:
95+
plt.plot(s.x, s.z_U, s.x, s.z_L, c='C0' if s.boundary == 'fluid' else 'C1')
96+
plt.gca().set_aspect('equal')
97+
plt.title(self.name)
98+
plt.show()
8899

89100

90101
class KRMdata():

0 commit comments

Comments
 (0)