Skip to content

flixopt.statistics_accessor

Statistics accessor for FlowSystem.

This module provides a user-friendly API for analyzing optimization results directly from a FlowSystem.

Structure
  • .stats - Data/metrics access (cached xarray Datasets)
  • .stats.plot - Plotting methods using the statistics data
Example

flow_system.optimize(solver)

Data access

flow_system.stats.flow_rates flow_system.stats.flow_hours

Plotting

flow_system.stats.plot.balance('ElectricityBus') flow_system.stats.plot.heatmap('Boiler|on')

Attributes

SelectType module-attribute

SelectType = dict[str, Any]

xarray-style selection dict: {'time': slice(...), 'scenario': 'base'}

FilterType module-attribute

FilterType = str | list[str]

For include/exclude filtering: exact label(s) to match, e.g., 'Boiler(Q_th)' or ['Boiler(Q_th)', 'CHP(Q_th)']

FlowSankeySelect module-attribute

FlowSankeySelect = dict[Literal['flow', 'bus', 'component', 'carrier', 'time', 'period', 'scenario'], Any]

Select options for flow-based sankey: flow, bus, component, carrier, time, period, scenario.

EffectsSankeySelect module-attribute

EffectsSankeySelect = dict[Literal['effect', 'component', 'contributor', 'period', 'scenario'], Any]

Select options for effects sankey: effect, component, contributor, period, scenario.

Classes

StatisticsAccessor

StatisticsAccessor(flow_system: FlowSystem)

Statistics accessor for FlowSystem. Access via flow_system.stats.

This accessor provides cached data properties for optimization results. Use .plot for visualization methods.

Data Properties

flow_rates : xr.Dataset Flow rates for all flows. flow_hours : xr.Dataset Flow hours (energy) for all flows. sizes : xr.Dataset Sizes for all flows. charge_states : xr.Dataset Charge states for all storage components. temporal_effects : xr.Dataset Temporal effects per contributor per timestep. periodic_effects : xr.Dataset Periodic (investment) effects per contributor. total_effects : xr.Dataset Total effects (temporal + periodic) per contributor. effect_share_factors : dict Conversion factors between effects.

Examples:

>>> flow_system.optimize(solver)
>>> flow_system.stats.flow_rates  # Get data
>>> flow_system.stats.plot.balance('Bus')  # Plot

Attributes

carrier_colors property
carrier_colors: dict[str, str]

Cached mapping of carrier name to color.

Delegates to topology accessor for centralized color caching.

Returns:

Type Description
dict[str, str]

Dict mapping carrier names (lowercase) to hex color strings.

component_colors property
component_colors: dict[str, str]

Cached mapping of component label to color.

Delegates to topology accessor for centralized color caching.

Returns:

Type Description
dict[str, str]

Dict mapping component labels to hex color strings.

flow_colors property
flow_colors: dict[str, str]

Cached mapping of flow label_full to color (from parent component).

Delegates to topology accessor for centralized color caching.

Returns:

Type Description
dict[str, str]

Dict mapping flow labels (e.g., 'Boiler(Q_th)') to hex color strings.

bus_colors property
bus_colors: dict[str, str]

Cached mapping of bus label to color (from carrier).

Delegates to topology accessor for centralized color caching.

Returns:

Type Description
dict[str, str]

Dict mapping bus labels to hex color strings.

carrier_units property
carrier_units: dict[str, str]

Cached mapping of carrier name to unit string.

Delegates to topology accessor for centralized unit caching.

Returns:

Type Description
dict[str, str]

Dict mapping carrier names (lowercase) to unit strings.

effect_units property
effect_units: dict[str, str]

Cached mapping of effect label to unit string.

Delegates to topology accessor for centralized unit caching.

Returns:

Type Description
dict[str, str]

Dict mapping effect labels to unit strings.

plot property
plot: StatisticsPlotAccessor

Access plotting methods for statistics.

Returns:

Type Description
StatisticsPlotAccessor

A StatisticsPlotAccessor instance.

Examples:

>>> flow_system.stats.plot.balance('ElectricityBus')
>>> flow_system.stats.plot.heatmap('Boiler|on')
flow_rates property
flow_rates: Dataset

All flow rates as a Dataset with flow labels as variable names.

Each variable has attributes
  • 'carrier': carrier type (e.g., 'heat', 'electricity', 'gas')
  • 'unit': carrier unit (e.g., 'kW')
flow_hours property
flow_hours: Dataset

All flow hours (energy) as a Dataset with flow labels as variable names.

Each variable has attributes
  • 'carrier': carrier type (e.g., 'heat', 'electricity', 'gas')
  • 'unit': energy unit (e.g., 'kWh', 'm3/s*h')
flow_sizes property
flow_sizes: Dataset

Flow sizes as a Dataset with flow labels as variable names.

storage_sizes property
storage_sizes: Dataset

Storage capacity sizes as a Dataset with storage labels as variable names.

sizes property
sizes: Dataset

All investment sizes (flows and storage capacities) as a Dataset.

charge_states property
charge_states: Dataset

All storage charge states as a Dataset with storage labels as variable names.

effect_share_factors property
effect_share_factors: dict[str, dict]

Effect share factors for temporal and periodic modes.

Returns:

Type Description
dict[str, dict]

Dict with 'temporal' and 'periodic' keys, each containing

dict[str, dict]

conversion factors between effects.

temporal_effects property
temporal_effects: Dataset

Temporal effects per contributor per timestep.

Returns a Dataset where each effect is a data variable with dimensions [time, contributor] (plus period/scenario if present).

Coordinates
  • contributor: Individual contributor labels
  • component: Parent component label for groupby operations
  • component_type: Component type (e.g., 'Boiler', 'Source', 'Sink')

Examples:

>>> # Get costs per contributor per timestep
>>> statistics.temporal_effects['costs']
>>> # Sum over all contributors to get total costs per timestep
>>> statistics.temporal_effects['costs'].sum('contributor')
>>> # Group by component
>>> statistics.temporal_effects['costs'].groupby('component').sum()

Returns:

Type Description
Dataset

xr.Dataset with effects as variables and contributor dimension.

periodic_effects property
periodic_effects: Dataset

Periodic (investment) effects per contributor.

Returns a Dataset where each effect is a data variable with dimensions [contributor] (plus period/scenario if present).

Coordinates
  • contributor: Individual contributor labels
  • component: Parent component label for groupby operations
  • component_type: Component type (e.g., 'Boiler', 'Source', 'Sink')

Examples:

>>> # Get investment costs per contributor
>>> statistics.periodic_effects['costs']
>>> # Sum over all contributors to get total investment costs
>>> statistics.periodic_effects['costs'].sum('contributor')
>>> # Group by component
>>> statistics.periodic_effects['costs'].groupby('component').sum()

Returns:

Type Description
Dataset

xr.Dataset with effects as variables and contributor dimension.

total_effects property
total_effects: Dataset

Total effects (temporal + periodic) per contributor.

Returns a Dataset where each effect is a data variable with dimensions [contributor] (plus period/scenario if present).

Coordinates
  • contributor: Individual contributor labels
  • component: Parent component label for groupby operations
  • component_type: Component type (e.g., 'Boiler', 'Source', 'Sink')

Examples:

>>> # Get total costs per contributor
>>> statistics.total_effects['costs']
>>> # Sum over all contributors to get total system costs
>>> statistics.total_effects['costs'].sum('contributor')
>>> # Group by component
>>> statistics.total_effects['costs'].groupby('component').sum()
>>> # Group by component type
>>> statistics.total_effects['costs'].groupby('component_type').sum()

Returns:

Type Description
Dataset

xr.Dataset with effects as variables and contributor dimension.

Functions

get_effect_shares
get_effect_shares(element: str, effect: str, mode: Literal['temporal', 'periodic'] | None = None, include_flows: bool = False) -> xr.Dataset

Retrieve individual effect shares for a specific element and effect.

Parameters:

Name Type Description Default
element str

The element identifier (component or flow label).

required
effect str

The effect identifier.

required
mode Literal['temporal', 'periodic'] | None

'temporal', 'periodic', or None for both.

None
include_flows bool

Whether to include effects from flows connected to this element.

False

Returns:

Type Description
Dataset

xr.Dataset containing the requested effect shares.

Raises:

Type Description
ValueError

If the effect is not available or mode is invalid.

SankeyPlotAccessor

SankeyPlotAccessor(plot_accessor: StatisticsPlotAccessor)

Sankey diagram accessor. Access via flow_system.stats.plot.sankey.

Provides typed methods for different sankey diagram types.

Examples:

>>> fs.stats.plot.sankey.flows(select={'bus': 'HeatBus'})
>>> fs.stats.plot.sankey.effects(select={'effect': 'costs'})
>>> fs.stats.plot.sankey.sizes(select={'component': 'Boiler'})

Functions

flows
flows(*, aggregate: Literal['sum', 'mean'] = 'sum', select: FlowSankeySelect | None = None, colors: ColorType | None = None, show: bool | None = None, **plotly_kwargs: Any) -> PlotResult

Plot Sankey diagram of energy/material flow amounts.

Parameters:

Name Type Description Default
aggregate Literal['sum', 'mean']

How to aggregate over time ('sum' or 'mean').

'sum'
select FlowSankeySelect | None

Filter options: - flow: filter by flow label (e.g., 'Boiler|Q_th') - bus: filter by bus label (e.g., 'HeatBus') - component: filter by component label (e.g., 'Boiler') - time: select specific time (e.g., 100 or '2023-01-01') - period, scenario: xarray dimension selection

None
colors ColorType | None

Color specification for nodes.

None
show bool | None

Whether to display the figure.

None
**plotly_kwargs Any

Additional arguments passed to Plotly layout.

{}

Returns:

Type Description
PlotResult

PlotResult with Sankey flow data and figure.

sizes
sizes(*, select: FlowSankeySelect | None = None, max_size: float | None = None, colors: ColorType | None = None, show: bool | None = None, **plotly_kwargs: Any) -> PlotResult

Plot Sankey diagram of investment sizes/capacities.

Parameters:

Name Type Description Default
select FlowSankeySelect | None

Filter options: - flow: filter by flow label (e.g., 'Boiler|Q_th') - bus: filter by bus label (e.g., 'HeatBus') - component: filter by component label (e.g., 'Boiler') - period, scenario: xarray dimension selection

None
max_size float | None

Filter flows with sizes exceeding this value.

None
colors ColorType | None

Color specification for nodes.

None
show bool | None

Whether to display the figure.

None
**plotly_kwargs Any

Additional arguments passed to Plotly layout.

{}

Returns:

Type Description
PlotResult

PlotResult with Sankey size data and figure.

peak_flow
peak_flow(*, select: FlowSankeySelect | None = None, colors: ColorType | None = None, show: bool | None = None, **plotly_kwargs: Any) -> PlotResult

Plot Sankey diagram of peak (maximum) flow rates.

Parameters:

Name Type Description Default
select FlowSankeySelect | None

Filter options: - flow: filter by flow label (e.g., 'Boiler|Q_th') - bus: filter by bus label (e.g., 'HeatBus') - component: filter by component label (e.g., 'Boiler') - time, period, scenario: xarray dimension selection

None
colors ColorType | None

Color specification for nodes.

None
show bool | None

Whether to display the figure.

None
**plotly_kwargs Any

Additional arguments passed to Plotly layout.

{}

Returns:

Type Description
PlotResult

PlotResult with Sankey peak flow data and figure.

effects
effects(*, select: EffectsSankeySelect | None = None, colors: ColorType | None = None, show: bool | None = None, **plotly_kwargs: Any) -> PlotResult

Plot Sankey diagram of component contributions to effects.

Shows how each component contributes to costs, CO2, and other effects.

Parameters:

Name Type Description Default
select EffectsSankeySelect | None

Filter options: - effect: filter which effects are shown (e.g., 'costs', ['costs', 'CO2']) - component: filter by component label (e.g., 'Boiler') - contributor: filter by contributor label (e.g., 'Boiler|Q_th') - period, scenario: xarray dimension selection

None
colors ColorType | None

Color specification for nodes.

None
show bool | None

Whether to display the figure.

None
**plotly_kwargs Any

Additional arguments passed to Plotly layout.

{}

Returns:

Type Description
PlotResult

PlotResult with Sankey effects data and figure.

StatisticsPlotAccessor

StatisticsPlotAccessor(statistics: StatisticsAccessor)

Plot accessor for statistics. Access via flow_system.stats.plot.

All methods return PlotResult with both data and figure.

Attributes

sankey property
sankey: SankeyPlotAccessor

Access sankey diagram methods with typed select options.

Returns:

Type Description
SankeyPlotAccessor

SankeyPlotAccessor with methods: flows(), sizes(), peak_flow(), effects()

Examples:

>>> fs.stats.plot.sankey.flows(select={'bus': 'HeatBus'})
>>> fs.stats.plot.sankey.effects(select={'effect': 'costs'})

Functions

balance
balance(node: str, *, select: SelectType | None = None, include: FilterType | None = None, exclude: FilterType | None = None, unit: Literal['flow_rate', 'flow_hours'] = 'flow_rate', colors: ColorType | None = None, round_decimals: int | None = 6, threshold: float | None = 1e-05, show: bool | None = None, data_only: bool = False, **plotly_kwargs: Any) -> PlotResult

Plot node balance (inputs vs outputs) for a Bus or Component.

Parameters:

Name Type Description Default
node str

Label of the Bus or Component to plot.

required
select SelectType | None

xarray-style selection dict.

None
include FilterType | None

Only include flows with these exact labels.

None
exclude FilterType | None

Exclude flows with these exact labels.

None
unit Literal['flow_rate', 'flow_hours']

'flow_rate' (power) or 'flow_hours' (energy).

'flow_rate'
colors ColorType | None

Color specification (colorscale name, color list, or label-to-color dict).

None
round_decimals int | None

Round values to this many decimal places to avoid numerical noise (e.g., tiny negative values from solver precision). Set to None to disable.

6
threshold float | None

Filter out variables where max absolute value is below this. Useful for removing solver noise. Set to None to disable.

1e-05
show bool | None

Whether to display the plot.

None
data_only bool

If True, skip figure creation and return only data (for performance).

False
**plotly_kwargs Any

Additional arguments passed to the plotly accessor (e.g., facet_col, facet_row, animation_frame).

{}

Returns:

Type Description
PlotResult

PlotResult with .data and .figure.

carrier_balance
carrier_balance(carrier: str, *, select: SelectType | None = None, include: FilterType | None = None, exclude: FilterType | None = None, unit: Literal['flow_rate', 'flow_hours'] = 'flow_rate', colors: ColorType | None = None, round_decimals: int | None = 6, threshold: float | None = 1e-05, show: bool | None = None, data_only: bool = False, **plotly_kwargs: Any) -> PlotResult

Plot carrier-level balance showing all flows of a carrier type.

Shows production (positive) and consumption (negative) of a carrier across all buses of that carrier type in the system.

Parameters:

Name Type Description Default
carrier str

Carrier name (e.g., 'heat', 'electricity', 'gas').

required
select SelectType | None

xarray-style selection dict.

None
include FilterType | None

Only include flows with these exact labels.

None
exclude FilterType | None

Exclude flows with these exact labels.

None
unit Literal['flow_rate', 'flow_hours']

'flow_rate' (power) or 'flow_hours' (energy).

'flow_rate'
colors ColorType | None

Color specification (colorscale name, color list, or label-to-color dict).

None
round_decimals int | None

Round values to this many decimal places to avoid numerical noise (e.g., tiny negative values from solver precision). Set to None to disable.

6
threshold float | None

Filter out variables where max absolute value is below this. Useful for removing solver noise. Set to None to disable.

1e-05
show bool | None

Whether to display the plot.

None
data_only bool

If True, skip figure creation and return only data (for performance).

False
**plotly_kwargs Any

Additional arguments passed to the plotly accessor (e.g., facet_col, facet_row, animation_frame).

{}

Returns:

Type Description
PlotResult

PlotResult with .data and .figure.

Examples:

>>> fs.stats.plot.carrier_balance('heat')
>>> fs.stats.plot.carrier_balance('electricity', unit='flow_hours')
Notes
  • Data is aggregated by component (not individual flows)
  • Supply (inputs to carrier buses) shown as positive
  • Demand (outputs from carrier buses) shown as negative
  • Components with both supply and demand get separate entries (e.g., 'Storage (supply)' and 'Storage (demand)')
heatmap
heatmap(variables: str | list[str], *, select: SelectType | None = None, reshape: tuple[str, str] | Literal['auto'] | None = ('D', 'h'), colors: str | list[str] | None = None, threshold: float | None = 1e-05, show: bool | None = None, data_only: bool = False, **plotly_kwargs: Any) -> PlotResult

Plot heatmap of time series data.

By default, time is reshaped into days × hours for clear daily pattern visualization. For clustered data, the natural (cluster, time) shape is used instead.

Multiple variables are shown as facets. If no time dimension exists, reshaping is skipped and data dimensions are used directly.

Parameters:

Name Type Description Default
variables str | list[str]

Flow label(s) or variable name(s). Flow labels like 'Boiler(Q_th)' are automatically resolved to 'Boiler(Q_th)|flow_rate'. Full variable names like 'Storage|charge_state' are used as-is.

required
select SelectType | None

xarray-style selection, e.g. {'scenario': 'Base Case'}.

None
reshape tuple[str, str] | Literal['auto'] | None

Time reshape frequencies as (outer, inner). Default ('D', 'h') reshapes into days × hours. Use None to disable reshaping and use data dimensions directly.

('D', 'h')
colors str | list[str] | None

Colorscale name (str) or list of colors for heatmap coloring. Dicts are not supported for heatmaps (use str or list[str]).

None
threshold float | None

Filter out variables where max absolute value is below this. Useful for removing solver noise. Set to None to disable.

1e-05
show bool | None

Whether to display the figure.

None
data_only bool

If True, skip figure creation and return only data (for performance).

False
**plotly_kwargs Any

Additional arguments passed to plotly accessor (e.g., facet_col, animation_frame).

{}

Returns:

Type Description
PlotResult

PlotResult with processed data and figure.

flows
flows(*, start: str | list[str] | None = None, end: str | list[str] | None = None, component: str | list[str] | None = None, select: SelectType | None = None, unit: Literal['flow_rate', 'flow_hours'] = 'flow_rate', colors: ColorType | None = None, threshold: float | None = 1e-05, show: bool | None = None, data_only: bool = False, **plotly_kwargs: Any) -> PlotResult

Plot flow rates filtered by start/end nodes or component.

Parameters:

Name Type Description Default
start str | list[str] | None

Filter by source node(s).

None
end str | list[str] | None

Filter by destination node(s).

None
component str | list[str] | None

Filter by parent component(s).

None
select SelectType | None

xarray-style selection.

None
unit Literal['flow_rate', 'flow_hours']

'flow_rate' or 'flow_hours'.

'flow_rate'
colors ColorType | None

Color specification (colorscale name, color list, or label-to-color dict).

None
threshold float | None

Filter out variables where max absolute value is below this. Useful for removing solver noise. Set to None to disable.

1e-05
show bool | None

Whether to display.

None
data_only bool

If True, skip figure creation and return only data (for performance).

False
**plotly_kwargs Any

Additional arguments passed to the plotly accessor (e.g., facet_col, facet_row, animation_frame).

{}

Returns:

Type Description
PlotResult

PlotResult with flow data.

sizes
sizes(*, max_size: float | None = 1000000.0, select: SelectType | None = None, colors: ColorType | None = None, threshold: float | None = 1e-05, show: bool | None = None, data_only: bool = False, **plotly_kwargs: Any) -> PlotResult

Plot investment sizes (capacities) of flows.

Parameters:

Name Type Description Default
max_size float | None

Maximum size to include (filters defaults).

1000000.0
select SelectType | None

xarray-style selection.

None
colors ColorType | None

Color specification (colorscale name, color list, or label-to-color dict).

None
threshold float | None

Filter out variables where max absolute value is below this. Useful for removing non-invested components. Set to None to disable.

1e-05
show bool | None

Whether to display.

None
data_only bool

If True, skip figure creation and return only data (for performance).

False
**plotly_kwargs Any

Additional arguments passed to the plotly accessor (e.g., facet_col, facet_row, animation_frame).

{}

Returns:

Type Description
PlotResult

PlotResult with size data.

duration_curve
duration_curve(variables: str | list[str], *, select: SelectType | None = None, normalize: bool = False, colors: ColorType | None = None, threshold: float | None = 1e-05, show: bool | None = None, data_only: bool = False, **plotly_kwargs: Any) -> PlotResult

Plot load duration curves (sorted time series).

Parameters:

Name Type Description Default
variables str | list[str]

Flow label(s) or variable name(s). Flow labels like 'Boiler(Q_th)' are looked up in flow_rates. Full variable names like 'Boiler(Q_th)|flow_rate' are stripped to their flow label. Other variables (e.g., 'Storage|charge_state') are looked up in the solution directly.

required
select SelectType | None

xarray-style selection.

None
normalize bool

If True, normalize x-axis to 0-100%.

False
colors ColorType | None

Color specification (colorscale name, color list, or label-to-color dict).

None
threshold float | None

Filter out variables where max absolute value is below this. Useful for removing solver noise. Set to None to disable.

1e-05
show bool | None

Whether to display.

None
data_only bool

If True, skip figure creation and return only data (for performance).

False
**plotly_kwargs Any

Additional arguments passed to the plotly accessor (e.g., facet_col, facet_row, animation_frame).

{}

Returns:

Type Description
PlotResult

PlotResult with sorted duration curve data.

effects
effects(aspect: Literal['total', 'temporal', 'periodic'] = 'total', *, effect: str | None = None, by: Literal['component', 'contributor', 'time'] | None = None, select: SelectType | None = None, colors: ColorType | None = None, threshold: float | None = 1e-05, show: bool | None = None, data_only: bool = False, **plotly_kwargs: Any) -> PlotResult

Plot effect (cost, emissions, etc.) breakdown.

Parameters:

Name Type Description Default
aspect Literal['total', 'temporal', 'periodic']

Which aspect to plot - 'total', 'temporal', or 'periodic'.

'total'
effect str | None

Specific effect name to plot (e.g., 'costs', 'CO2'). If None, plots all effects.

None
by Literal['component', 'contributor', 'time'] | None

Group by 'component', 'contributor' (individual flows), 'time', or None to show aggregated totals per effect.

None
select SelectType | None

xarray-style selection.

None
colors ColorType | None

Color specification (colorscale name, color list, or label-to-color dict).

None
threshold float | None

Filter out variables where max absolute value is below this. Useful for removing solver noise. Set to None to disable.

1e-05
show bool | None

Whether to display.

None
data_only bool

If True, skip figure creation and return only data (for performance).

False
**plotly_kwargs Any

Additional arguments passed to the plotly accessor (e.g., facet_col, facet_row, animation_frame).

{}

Returns:

Type Description
PlotResult

PlotResult with effect breakdown data.

Examples:

>>> flow_system.stats.plot.effects()  # Aggregated totals per effect
>>> flow_system.stats.plot.effects(effect='costs')  # Just costs
>>> flow_system.stats.plot.effects(by='component')  # Breakdown by component
>>> flow_system.stats.plot.effects(by='contributor')  # By individual flows
>>> flow_system.stats.plot.effects(aspect='temporal', by='time')  # Over time
charge_states
charge_states(storages: str | list[str] | None = None, *, select: SelectType | None = None, colors: ColorType | None = None, threshold: float | None = 1e-05, show: bool | None = None, data_only: bool = False, **plotly_kwargs: Any) -> PlotResult

Plot storage charge states over time.

Parameters:

Name Type Description Default
storages str | list[str] | None

Storage label(s) to plot. If None, plots all storages.

None
select SelectType | None

xarray-style selection.

None
colors ColorType | None

Color specification (colorscale name, color list, or label-to-color dict).

None
threshold float | None

Filter out variables where max absolute value is below this. Useful for removing non-invested storages. Set to None to disable.

1e-05
show bool | None

Whether to display.

None
data_only bool

If True, skip figure creation and return only data (for performance).

False
**plotly_kwargs Any

Additional arguments passed to the plotly accessor (e.g., facet_col, facet_row, animation_frame).

{}

Returns:

Type Description
PlotResult

PlotResult with charge state data.

storage
storage(storage: str, *, select: SelectType | None = None, unit: Literal['flow_rate', 'flow_hours'] = 'flow_rate', colors: ColorType | None = None, charge_state_color: str = 'black', round_decimals: int | None = 6, threshold: float | None = 1e-05, show: bool | None = None, data_only: bool = False, **plotly_kwargs: Any) -> PlotResult

Plot storage operation: balance and charge state in vertically stacked subplots.

Creates two subplots sharing the x-axis: - Top: Charging/discharging flows as stacked bars (inputs negative, outputs positive) - Bottom: Charge state over time as a line

Parameters:

Name Type Description Default
storage str

Storage component label.

required
select SelectType | None

xarray-style selection.

None
unit Literal['flow_rate', 'flow_hours']

'flow_rate' (power) or 'flow_hours' (energy).

'flow_rate'
colors ColorType | None

Color specification for flow bars.

None
charge_state_color str

Color for the charge state line overlay.

'black'
round_decimals int | None

Round values to this many decimal places to avoid numerical noise (e.g., tiny negative values from solver precision). Set to None to disable.

6
threshold float | None

Filter out flow variables where max absolute value is below this. Useful for removing solver noise. Set to None to disable.

1e-05
show bool | None

Whether to display.

None
data_only bool

If True, skip figure creation and return only data (for performance).

False
**plotly_kwargs Any

Additional arguments passed to the plotly accessor (e.g., facet_col, facet_row, animation_frame).

{}

Returns:

Type Description
PlotResult

PlotResult with combined balance and charge state data.

Raises:

Type Description
KeyError

If storage component not found.

ValueError

If component is not a storage.

Functions