Untitled

 avatar
unknown
plain_text
a month ago
1.0 kB
2
Indexable
import matplotlib.pyplot as plt

# Data for comparison
locations = ['Green Axis', 'Multipurpose Hall', 'Mosque (Daily)', 'Mosque (Friday)']
energy_generated = [10.0, 25.0, 10.0, 60.0]  # kWh 
lighting_demand = [8.4, 6.0, 14.4, 14.4]  # kWh

# Create a bar graph for Energy Generated vs Lighting Demand
fig, ax = plt.subplots(1, 2, figsize=(14, 6))

# Bar graph
ax[0].bar(locations, energy_generated, label='Energy Generated (kWh)', alpha=0.6, color='b', width=0.4, align='center')
ax[0].bar(locations, lighting_demand, label='Lighting Demand (kWh)', alpha=0.6, color='r', width=0.4, align='edge')
ax[0].set_title('Energy Generated vs. Lighting Demand (Bar Graph)')
ax[0].set_ylabel('kWh')
ax[0].legend()

# Pie chart for total comparison
ax[1].pie([sum(energy_generated), sum(lighting_demand)], labels=['Energy Generated', 'Lighting Demand'], autopct='%1.1f%%', colors=['blue', 'red'], startangle=90)
ax[1].set_title('Total Energy Comparison (Pie Chart)')

plt.tight_layout()
plt.show()
Leave a Comment