Closed lucdevries closed 2 years ago
There is quite a lot going on in your code. To be sure we are talking about the same thing, consider the following simpler code. Does this solve your problems?
def demand(p):
return 1-p
def supply(p):
return p
p = 0.6
range_p = np.linspace(0,1)
plt.plot(demand(range_p),range_p)
plt.plot(supply(range_p),range_p)
plt.hlines(p,0,demand(p))
plt.vlines(demand(p),demand(p),p)
range_d = np.linspace(0,demand(p))
plt.fill_between(range_d,1-range_d,[0.6 for d in range_d],color='y')
I simplified the code a bit and I have got it now. Thank you!
We tried to fill in a specific part of one of our graphs between two x values using plt.fill_between, however it failed to work. We want to fill in the DWL part in the graph below but we cannot seem to get it right. Another problem we have encountered is for the producer surplus as the cut off seems to be somewhat diagonal while it should be fully vertical. Furthermore we tried to implement a line between DWL and Producer surplus and it did not go at the right coordinates.
Thanks in advance! Paul de Graaf and Luc de Vries.