The following example code produces the plot below
names_legend = [
'$Q_{coll}(T_{in})$',
'$Q_{coll}(T_{out})$',
'$Q_{Hx}(T_{in})$',
'$Q_{Hx}(T_{out})$',
'$Q_{evap}(T_{in})$',
'$Q_{evap}(T_{out})$',
'$Q_{dem}(T_{in})$',
'$Q_{dem}(T_{out})$',
]
plot_variables = [
["CollP_kW_calc", "CollTIn"],
["CollP_kW_calc", "CollTOut"],
["HxQ_kW", "HxTSide1In"],
["HxQ_kW", "HxTSide1Out"],
["HpQEvap_kW", "HpTEvapIn"],
["HpQEvap_kW", "HpTEvapOut"],
["QSnkP_kW", "QSnkTIn"],
["QSnkP_kW", "QSnkTOut"],
]
dataframes = pd.DataFrame() #[]
_plt.figure()
for q, t in plot_variables:
a = abs(sim.hourly[q])
b = sim.hourly[t]
df = pd.DataFrame({q: a, t: b})
df = df.sort_values(by=t)
df[q] = np.cumsum(df[q])
# dataframes = dataframes + a + b
# dataframes.append(df)
fig = _plt.plot(df[t], df[q], label=q + "____" + t) # , linestyle='-', color='blue', label='Q_cum')
_plt.xlabel('Temperature [°C]')
_plt.ylabel('Cumulative energy [kWh]')
_plt.grid()
_plt.legend(names_legend)
api.export_plots_in_configured_formats(fig[0].figure, sim.path, "q_t", "q_vs_t")

The following example code produces the plot below