swmmx Documentation

Plotting Reference: Profiles

Rendered from 15_all_plot_functions.ipynb.

m.plot_profile

Public APIPath selector inputBehavior
m.plot_profile.nodes(start_node, end_node, ...)Existing start/end node IDsFind a directed hydraulic path between nodes, then plot it.
m.plot_profile.links(ids, ...)One ordered link ID or list of link IDsValidate connected order in either direction, then plot exactly that sequence.
m.plot_profile.longest(...)No path selectorFind the longest directed conduit path and plot it.

Profile inputs

Profiles use directed conduit connectivity, node invert elevations, conduit lengths, and conduit full depths. Ground elevation is approximated from node invert plus max depth when needed. EGL is currently not exposed by the result layer, so requesting show_egl=True emits a warning and skips that overlay.

InputTypeDefaultMeaning
time_stepint-1Result row index for overlay variables; -1 means last row.
aggregation`str \None`None
legendboolTrueShow profile legend.
gridboolTrueShow grid lines.
title`str \None`None
legend_title`str \None`None
axisboolTrueShow axes and ticks.
x_axis_title`str \None`None
y_axis_title`str \None`None
save_format`str \None`None
save_path`str \Path \None`
figsizetuple[float, float](12, 5)Figure size when ax is not supplied.
dpiint300Figure resolution.
axmatplotlib `Axes \None`None
showboolTrueCall plt.show() after rendering.
unit_length, unit_elevation`str \None`None
show_groundboolTrueDraw approximated ground line.
show_conduitsboolTrueDraw conduit barrels.
show_invertboolTrueDraw node invert line.
show_crownboolTrueDraw conduit crown line.
show_hglboolFalseDraw hydraulic grade line; requires results.
show_eglboolFalseRequest energy grade line; currently warns and skips because EGL is not exposed.
show_water_depthboolFalseDraw water level; requires results.
show_node_labelsboolTrueAnnotate nodes.
show_link_labelsboolTrueAnnotate links on their conduit barrels.
show_node_guidesboolTrueDraw prominent vertical dotted lines at node locations.
show_surchargeboolTrueMark surcharge locations when results are available.
show_floodingboolTrueMark flooding locations when results are available.
fill_conduitsboolTrueShade conduit barrels between invert and crown.
line_styles`dict[str, str] \None`None
colors`dict[str, str] \None`None

Profile examples

m.plot_profile.nodes('J1', 'OUT1', show_hgl=True, aggregation='max')
m.plot_profile.links(['C1', 'C2', 'C3'])  # connected walks may follow or oppose hydraulic direction
m.plot_profile.longest(show_hgl=True, aggregation='max')
Code cell 1
fig, ax = m.plot_profile.longest(
    show_hgl=True,
    aggregation='max',
    title='Longest path profile',
    show=False,
    save_path=output_dir / 'notebook_profile_example.png',
)
plt.close(fig)