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.
| Input | Type | Default | Meaning |
|---|---|---|---|
ids | `None \ | str \ | list[str]` |
legend | bool | True | Show line legend. |
grid | bool | True | Show grid lines. |
title | `str \ | None` | None |
legend_title | `str \ | None` | None |
axis | bool | True | Show 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` |
figsize | tuple[float, float] | (10, 4) | Figure size when ax is not supplied. |
dpi | int | 300 | Figure resolution. |
ax | matplotlib `Axes \ | None` | None |
show | bool | True | Call plt.show() after rendering. |
time_format | `'datetime' \ | 'clock' \ | 'elapsed'` |
start_time, end_time | timestamp-like | None | Optional time-window filters. |
labels | `dict \ | list \ | tuple \ |
linewidth | float | 1.5 | Line width. |
linestyle | str | '-' | Matplotlib line style. |
marker | matplotlib marker or None | None | Optional point marker. |
alpha | float | 1.0 | Line transparency. |
Available time-series variables
| Category | Available variables | ID behavior | Example endpoint |
|---|---|---|---|
conduit | capacity, depth, flow, velocity | ids=None, one ID string, or a list of ID strings | m.plot_timeseries.conduit.capacity(...) |
inlet | captured_flow | ids=None, one ID string, or a list of ID strings | m.plot_timeseries.inlet.captured_flow(...) |
lid_usage | drain_outflow, evaporation, infiltration, inflow, storage, surface_outflow | ids=None, one ID string, or a list of ID strings | m.plot_timeseries.lid_usage.drain_outflow(...) |
link | capacity, depth, flow, pollutant_concentration, setting, velocity, volume | ids=None, one ID string, or a list of ID strings | m.plot_timeseries.link.capacity(...) |
node | depth, flooding, head, lateral_inflow, overflow, pollutant_concentration, total_inflow, volume | ids=None, one ID string, or a list of ID strings | m.plot_timeseries.node.depth(...) |
orifice | flow, setting | ids=None, one ID string, or a list of ID strings | m.plot_timeseries.orifice.flow(...) |
outlet | flow, setting | ids=None, one ID string, or a list of ID strings | m.plot_timeseries.outlet.flow(...) |
pump | energy, flow, setting, status | ids=None, one ID string, or a list of ID strings | m.plot_timeseries.pump.energy(...) |
rain_gage | rainfall | ids=None, one ID string, or a list of ID strings | m.plot_timeseries.rain_gage.rainfall(...) |
street | spread | ids=None, one ID string, or a list of ID strings | m.plot_timeseries.street.spread(...) |
subcatchment | evaporation, groundwater_elevation, groundwater_flow, infiltration, pollutant_concentration, rainfall, runoff, snow_depth, soil_moisture | ids=None, one ID string, or a list of ID strings | m.plot_timeseries.subcatchment.evaporation(...) |
system | air_temperature, direct_inflow, dry_weather_inflow, evaporation, evaporation_loss, flooding, groundwater_inflow, infiltration, outflow, rainfall, rdii_inflow, runoff, snow_depth, total_lateral_inflow, volume | System-wide series; ids is not needed | m.plot_timeseries.system.air_temperature(...) |
system_result | air_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_inflow | ids=None, one ID string, or a list of ID strings | m.plot_timeseries.system_result.air_temperature(...) |
weir | flow, setting | ids=None, one ID string, or a list of ID strings | m.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')
# 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)