costs_workflow/costs/printing_results.py

58 lines
1.7 KiB
Python
Raw Normal View History

import plotly.graph_objects as go
import matplotlib.pyplot as plt
import plotly.express as px
def printing_results(investmentcosts, life_cycle_results,total_floor_area):
labels = investmentcosts.index
values = investmentcosts['retrofitting_scenario_1']
values2 = investmentcosts['retrofitting_scenario_2']
values3 = investmentcosts['retrofitting_scenario_3']
fig = go.Figure(data=[go.Pie(labels=labels, values=values)])
fig2 = go.Figure(data=[go.Pie(labels=labels, values=values2)])
fig3 = go.Figure(data=[go.Pie(labels=labels, values=values3)])
# Set the layout properties
fig.update_layout(
title='Retrofitting scenario 1',
showlegend=True
)
fig2.update_layout(
title='Retrofitting scenario 2',
showlegend=True
)
fig3.update_layout(
title='Retrofitting scenario 3',
showlegend=True
)
# Display the chart
fig.show()
fig2.show()
fig3.show()
df = life_cycle_results / total_floor_area
# Transpose the DataFrame (swap columns and rows)
df_swapped = df.transpose()
# Reset the index to make the current index a regular column
df_swapped = df_swapped.reset_index()
# Assign new column names
df_swapped.columns = ['Scenarios', 'total_capital_costs_skin',
'total_capital_costs_systems',
'end_of_life_costs',
'total_operational_costs',
'total_maintenance_costs',
'operational_incomes',
'capital_incomes']
df_swapped.index = df_swapped['Scenarios']
df_swapped = df_swapped.drop('Scenarios', axis=1)
print(df_swapped)
fig = px.bar(df_swapped, title='Life Cycle Costs for buildings')
fig.show()
# Display the chart
plt.show()