Untitled

mail@pastecode.io avatar
unknown
plain_text
7 days ago
1.2 kB
2
Indexable
Never
import matplotlib.pyplot as plt
import numpy as np

# Time range (2020 to 2030)
years = np.arange(2020, 2031)

# Simulating demand for conventional vehicles over time (declining linearly)
conv_vehicles_demand = np.linspace(100, 20, len(years))

# Simulating demand for fossil fuels over time (declining linearly)
fossil_fuel_demand = np.linspace(100, 30, len(years))

# Creating subplots
fig, ax = plt.subplots(2, 1, figsize=(8, 10))

# Plot 1: Demand for Conventional Vehicles
ax[0].plot(years, conv_vehicles_demand, marker='o', color='b', label='Conventional Vehicles Demand')
ax[0].set_title('Decline in Demand for Conventional Vehicles (2020-2030)')
ax[0].set_xlabel('Year')
ax[0].set_ylabel('Quantity of Conventional Vehicles Sold')
ax[0].grid(True)
ax[0].legend()

# Plot 2: Demand for Fossil Fuels
ax[1].plot(years, fossil_fuel_demand, marker='o', color='r', label='Fossil Fuels Demand')
ax[1].set_title('Decline in Demand for Fossil Fuels (2020-2030)')
ax[1].set_xlabel('Year')
ax[1].set_ylabel('Quantity of Fossil Fuels Sold')
ax[1].grid(True)
ax[1].legend()

# Adjust layout
plt.tight_layout()

# Show plot
plt.show()
Leave a Comment