Skip to content

Commit c00a722

Browse files
committed
update plot2d() to plot diff line types and match plot3d types
1 parent 4b1b96b commit c00a722

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

famodel/project.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,23 +2014,33 @@ def plot2d(self, ax=None, plot_seabed=True,plot_bathymetry=True, plot_boundary=T
20142014
from shapely import Point
20152015
for platform in self.platformList.values():
20162016
for name, env in platform.envelopes.items():
2017-
ax.fill(env['x'], env['y'], edgecolor=edgecolor, facecolor='none', linestyle='dashed', lw=0.8, label='Platform envelope')
2017+
ax.fill(env['x'], env['y'], edgecolor=edgecolor, facecolor='none', linestyle='dashed', lw=0.8, label='Platform Envelope')
20182018

20192019
if plot_moorings:
20202020
for mooring in self.mooringList.values():
20212021
for name, env in mooring.envelopes.items():
20222022
#if 'shape' in env: # if there's a shapely object
20232023
# pass # do nothing for now...
20242024
#elif 'x' in env and 'y' in env: # otherwise just use coordinates
2025-
ax.fill(env['x'], env['y'], color=color,label='Mooring envelope',alpha=alpha)
2025+
ax.fill(env['x'], env['y'], color=color,label='Mooring Envelope',alpha=alpha)
20262026

20272027

20282028
# Plot moorings one way or another (eventually might want to give Mooring a plot method)
20292029
for mooring in self.mooringList.values():
20302030

20312031
if mooring.ss: # plot with Subsystem if available
2032-
mooring.ss.drawLine2d(0, ax, color="k", endpoints=False,
2033-
Xuvec=[1,0,0], Yuvec=[0,1,0],label='Mooring Line')
2032+
labs = []
2033+
for line in mooring.ss.lineList:
2034+
if 'chain' in line.type['material']:
2035+
line.color = 'k'
2036+
elif 'polyester' in line.type['material']:
2037+
line.color = [.3,.5,.5]
2038+
else:
2039+
line.color = [0.5,0.5,0.5]
2040+
labs.append(line.type['material'][0].upper()+
2041+
line.type['material'][1:]+' Mooring')
2042+
mooring.ss.drawLine2d(0, ax, color="self", endpoints=False,
2043+
Xuvec=[1,0,0], Yuvec=[0,1,0],label=labs)
20342044
else: # simple line plot
20352045
ax.plot([mooring.rA[0], mooring.rB[0]],
20362046
[mooring.rA[1], mooring.rB[1]], 'k', lw=0.5, label='Mooring Line')
@@ -2090,7 +2100,7 @@ def plot2d(self, ax=None, plot_seabed=True,plot_bathymetry=True, plot_boundary=T
20902100
# ax.text(x,y, label)
20912101
elif isinstance(sub,DynamicCable):
20922102
ax.plot([sub.rA[0],sub.rB[0]],
2093-
[sub.rA[1], sub.rB[1]],'--',color = Ccable, lw=1.2,
2103+
[sub.rA[1], sub.rB[1]],color = Ccable, lw=1.2,
20942104
label='Dynamic Cable '+str(cableSize)+' mm$^{2}$')
20952105

20962106
if cable_labels:
@@ -2118,7 +2128,7 @@ def plot2d(self, ax=None, plot_seabed=True,plot_bathymetry=True, plot_boundary=T
21182128
else:
21192129
plotstring = 'bo'
21202130

2121-
ax.plot(platform.r[0], platform.r[1], plotstring ,label=entity)
2131+
ax.plot(platform.r[0], platform.r[1], plotstring, label=entity, ms=3.5)
21222132

21232133
ax.set_xlabel('X (m)')
21242134
ax.set_ylabel('Y (m)')

0 commit comments

Comments
 (0)