swmmx Documentation

Plotting Reference: Time Series

Rendered from 15_all_plot_functions.ipynb.

m.plot_timeseries.<category>.<variable>()

Time-series endpoints are generated dynamically from public result variables. They require a completed run and use a timestamp index by default. Their titles, grids, ticks, and axis labels use safe ordinary artists instead of native Matplotlib Axis artists, while legends use lightweight proxy lines rather than cloning the plotted artists. Together those two choices avoid the Spyder/Agg recursive marker-copy paths.

InputTypeDefaultMeaning
ids`None \str \list[str]`
legendboolTrueShow line 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](10, 4)Figure size when ax is not supplied.
dpiint300Figure resolution.
axmatplotlib `Axes \None`None
showboolTrueCall plt.show() after rendering.
time_format`'datetime' \'clock' \'elapsed'`
start_time, end_timetimestamp-likeNoneOptional time-window filters.
labels`dict \list \tuple \
linewidthfloat1.5Line width.
linestylestr'-'Matplotlib line style.
markermatplotlib marker or NoneNoneOptional point marker.
alphafloat1.0Line transparency.

Available time-series variables

CategoryAvailable variablesID behaviorExample endpoint
conduitcapacity, depth, flow, velocityids=None, one ID string, or a list of ID stringsm.plot_timeseries.conduit.capacity(...)
inletcaptured_flowids=None, one ID string, or a list of ID stringsm.plot_timeseries.inlet.captured_flow(...)
lid_usagedrain_outflow, evaporation, infiltration, inflow, storage, surface_outflowids=None, one ID string, or a list of ID stringsm.plot_timeseries.lid_usage.drain_outflow(...)
linkcapacity, depth, flow, pollutant_concentration, setting, velocity, volumeids=None, one ID string, or a list of ID stringsm.plot_timeseries.link.capacity(...)
nodedepth, flooding, head, lateral_inflow, overflow, pollutant_concentration, total_inflow, volumeids=None, one ID string, or a list of ID stringsm.plot_timeseries.node.depth(...)
orificeflow, settingids=None, one ID string, or a list of ID stringsm.plot_timeseries.orifice.flow(...)
outletflow, settingids=None, one ID string, or a list of ID stringsm.plot_timeseries.outlet.flow(...)
pumpenergy, flow, setting, statusids=None, one ID string, or a list of ID stringsm.plot_timeseries.pump.energy(...)
rain_gagerainfallids=None, one ID string, or a list of ID stringsm.plot_timeseries.rain_gage.rainfall(...)
streetspreadids=None, one ID string, or a list of ID stringsm.plot_timeseries.street.spread(...)
subcatchmentevaporation, groundwater_elevation, groundwater_flow, infiltration, pollutant_concentration, rainfall, runoff, snow_depth, soil_moistureids=None, one ID string, or a list of ID stringsm.plot_timeseries.subcatchment.evaporation(...)
systemair_temperature, direct_inflow, dry_weather_inflow, evaporation, evaporation_loss, flooding, groundwater_inflow, infiltration, outflow, rainfall, rdii_inflow, runoff, snow_depth, total_lateral_inflow, volumeSystem-wide series; ids is not neededm.plot_timeseries.system.air_temperature(...)
system_resultair_temperature, direct_inflow, dry_weather_inflow, evaporation, flooding, groundwater_inflow, infiltration, outfall_flow, pollutant_loading, rainfall, rdii_inflow, runoff, snow_depth, storage_volume, total_lateral_inflowids=None, one ID string, or a list of ID stringsm.plot_timeseries.system_result.air_temperature(...)
weirflow, settingids=None, one ID string, or a list of ID stringsm.plot_timeseries.weir.flow(...)

Time-series examples

m.run()
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')
Code cell 1
# Result-based plotting examples need an executed model.
m.run()
fig, ax = m.plot_timeseries.link.flow(
    ids=['P001', 'P005'],
    title='Conduit flow',
    y_axis_title='Flow',
    show=False,
    save_path=output_dir / 'notebook_timeseries_example.png',
)
plt.close(fig)