B
Brandon La Porte
I have the following code to make a plot of 4 different supply curves (economics).
from matplotlib import pyplot as plt
price = range(0,51)
q1 = [x/2.0 for x in price]
q2 = [x/4.0 for x in price]
q3 = [x/5.0 for x in price]
q4 = [x/10.0 for x in price]
markers_on = [20, 40]
plt.plot(q1,price,'b',q2,price,'g',q3,price,'r', q4, price, 'y' )
plt.title('Supply Curve')
plt.xlabel('Quantity Supplied (Thousands per month')
plt.ylabel('Price ($)')
#plt.legend(('Kd = %d'%kd, 'Kd = %d'%kd2, 'Kd = %d'% kd3, 'Step'), loc=4)
plt.legend(('p = 2Qs', 'p = 4Qs', 'p = 5Qs', 'p = 10Qs'), loc=4)
plt.grid()
plt.show()
I would like to place markers on the 4 curves when the price is equal to $20 label it A, and when the price is equal to $40 and label it B. Does anyone know how I can accomplish this.
from matplotlib import pyplot as plt
price = range(0,51)
q1 = [x/2.0 for x in price]
q2 = [x/4.0 for x in price]
q3 = [x/5.0 for x in price]
q4 = [x/10.0 for x in price]
markers_on = [20, 40]
plt.plot(q1,price,'b',q2,price,'g',q3,price,'r', q4, price, 'y' )
plt.title('Supply Curve')
plt.xlabel('Quantity Supplied (Thousands per month')
plt.ylabel('Price ($)')
#plt.legend(('Kd = %d'%kd, 'Kd = %d'%kd2, 'Kd = %d'% kd3, 'Step'), loc=4)
plt.legend(('p = 2Qs', 'p = 4Qs', 'p = 5Qs', 'p = 10Qs'), loc=4)
plt.grid()
plt.show()
I would like to place markers on the 4 curves when the price is equal to $20 label it A, and when the price is equal to $40 and label it B. Does anyone know how I can accomplish this.