Layout plotting
Plotting families, save behavior, layout options, layer styling, annotations, legends, and data-driven styles.
Open section
swmmx Documentation
swmmx uses matplotlib for layout maps, result time series, and longitudinal profiles. Plot functions return (fig, ax), support show=False, and support saving through save_path / save_format where implemented.
m.plot_layout()
m.plot_layout(title="Drainage Network", legend=True, grid=True, axis=True)
m.plot_layout(
links={
"color": {
"by": "parameter",
"category": "conduit",
"variable": "roughness",
"mode": "continuous",
"cmap": "viridis",
}
}
)
m.plot_layout(
annotation={
"nodes": "id",
"conduits": {"template": "{id}\nD={diameter:.2f} m", "rotation": "link", "bbox": True},
}
)
Layer dictionaries support nodes, links, subcatchments, connectors, rain gages, LID usages, and labels. Styles may be static or data-driven by model parameters, result variables, or user-provided ID/value mappings. Data-driven styling supports continuous and discrete color maps, node size, and link width.
m.plot_timeseries.link.flow(["C1", "C2"])
m.plot_timeseries.node.depth("J1", title="Node depth")
m.plot_timeseries.link.flow("C1", time_format="clock")
m.plot_timeseries.system.runoff(time_format="elapsed")
Result time series require a completed run. The time axis supports datetime, clock, and elapsed formats.
m.plot_profile.nodes("J1", "OUT1", show_hgl=True, aggregation="max")
m.plot_profile.links(["C1", "C2", "C3"])
m.plot_profile.longest(show_hgl=True, aggregation="max")
Profiles can plot node-to-node paths, explicit ordered link walks, or the longest directed conduit path. HGL/water overlays require results. Unknown IDs raise UnknownIDError; disconnected paths raise NoPathError.
Plotting families, save behavior, layout options, layer styling, annotations, legends, and data-driven styles.
Open sectionDynamic result plotting endpoints, IDs, time-axis modes, result requirements, and save behavior.
Open sectionNode paths, ordered links, longest paths, HGL/water overlays, aggregation, and profile controls.
Open sectionCommon plotting errors, missing coordinates, missing results, unknown IDs, and disconnected profile paths.
Open section