Untitled
unknown
plain_text
10 months ago
797 B
6
Indexable
import matplotlib.pyplot as plt
import numpy as np
# Setting up the plot
fig, ax = plt.subplots(figsize=(8, 6))
# Price and Quantity
Q = np.linspace(0, 10, 100)
D = 10 - Q # Demand curve
S1 = 2 + Q # Initial Supply curve
S2 = 3 + Q # New Supply curve (after tax)
# Plotting the curves
ax.plot(Q, D, label="Demand Curve", color='blue')
ax.plot(Q, S1, label="Initial Supply Curve (S1)", color='green')
ax.plot(Q, S2, label="New Supply Curve (S2)", color='red')
# Marking the equilibrium points
ax.fill_between(Q, D, S1, where=(Q >= 0) & (Q <= 6), color='gray', alpha=0.3, label="Deadweight Loss Area")
# Labels and title
ax.set_xlabel('Quantity')
ax.set_ylabel('Price')
ax.set_title('Deadweight Loss from the Tax Increase')
ax.legend()
plt.grid(True)
plt.show()
Editor is loading...
Leave a Comment