Plotting and figure export#

Install the optional plots extra to use these functions. Each plotting function returns a standalone Matplotlib figure, without creating a GUI window.

Optional Matplotlib figures built from simulation outputs, with no global GUI state.

x2power.utilities.plotting.plot_energy_balance(result, *, title='Electricity and process heat')[source]#

Plot signed electrical deductions and thermal heat allocation over one interval.

The heat panel reports heat delivered, not the heater’s electrical input. Unused recovered heat includes heat unsuitable for the specified process temperature.

Parameters:
Return type:

Figure

x2power.utilities.plotting.plot_sensitivity(rows, *, xlabel='Input value', title='Electricity sensitivity')[source]#

Plot a one-variable sweep, sorting numeric x values without mutating inputs.

Parameters:
  • rows (Sequence[Mapping[str, float]])

  • xlabel (str)

  • title (str)

Return type:

Figure

x2power.utilities.plotting.plot_profile(results, *, title='Operating profile')[source]#

Draw interval-mean power against actual elapsed hours, including negative net output.

Parameters:
Return type:

Figure

x2power.utilities.plotting.plot_uncertainty(net_electricity_kwh, *, bins=25, title='Net electricity under sampled assumptions')[source]#

Plot sample counts and empirical quantiles, without inferring confidence intervals.

Parameters:
  • net_electricity_kwh (Sequence[float])

  • bins (int)

  • title (str)

Return type:

Figure

x2power.utilities.plotting.save_figure(figure, path, *, dpi=150)[source]#

Save PNG, SVG or PDF, creating parent folders; return the resulting path.

Parameters:
  • figure (Figure)

  • path (str | Path)

  • dpi (float)

Return type:

Path