Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
653 B
1
Indexable
import matplotlib.pyplot as plt

# Data for renewable energy use in Singapore
years = [2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023]
renewable_energy_percentage = [5, 6, 8, 10, 12, 15, 18, 20, 22, 25]

# Create the line graph
plt.figure(figsize=(10, 6))
plt.plot(years, renewable_energy_percentage, marker='o', linestyle='-', color='b')

# Add titles and labels
plt.title('Trend in Renewable Energy Use in Singapore (2014-2023)')
plt.xlabel('Year')
plt.ylabel('Renewable Energy (% of Total Energy)')

# Show grid
plt.grid(True)

# Show the graph
plt.xticks(years)  # Ensure all years are marked on the x-axis
plt.tight_layout()
plt.show()
Leave a Comment