Skip to content

Combine the two graphs showing equilibrium. (Delete the first plot and leave the one with the equilibrium point. #499

Closed
@longye-tian

Description

@longye-tian

Dear John @jstac,

As mentioned in #434 , we talked about deleting the first plot in the olg.md as it is very similar to the next plot.

This issue tracker is to confirm the deletion and also a bit update the on the code of the second plot. I change the second code by

  • use default color on the equilibrium point
  • delete the arrow but using the legend to show the equilibrium.

I believe this simplifies the code without loss of key information. The original code is shown below:

R_vals = np.linspace(0.3, 1)
α, β = 0.5, 0.9
w = 2.0

fig, ax = plt.subplots()

ax.plot(R_vals, capital_demand(R_vals, α), 
        label="aggregate demand")
ax.plot(R_vals, capital_supply(R_vals, β, w), 
        label="aggregate supply")

R_e = equilibrium_R_log_utility(α, β, w)
k_e = (β / (1 + β)) * w

ax.plot(R_e, k_e, 'go', ms=6, alpha=0.6)

ax.annotate(r'equilibrium',
             xy=(R_e, k_e),
             xycoords='data',
             xytext=(0, 60),
             textcoords='offset points',
             fontsize=12,
             arrowprops=dict(arrowstyle="->"))

ax.set_xlabel("$R_{t+1}$")
ax.set_ylabel("$k_{t+1}$")
ax.legend()
plt.show()

My updated version is as follows:

R_vals = np.linspace(0.3, 1)
α, β = 0.5, 0.9
w = 2.0

fig, ax = plt.subplots()

ax.plot(R_vals, capital_demand(R_vals, α), 
        label="aggregate demand")
ax.plot(R_vals, capital_supply(R_vals, β, w), 
        label="aggregate supply")

R_e = equilibrium_R_log_utility(α, β, w)
k_e = (β / (1 + β)) * w

ax.plot(R_e, k_e, 'o',label='equilibrium')

ax.set_xlabel("$R_{t+1}$")
ax.set_ylabel("$k_{t+1}$")
ax.legend()
plt.show()

Here is a comparison of these two plots (first one is the original plot):
original plot
update plot

What do you think about this change? Would you like to make any changes?

Best ❤️
Longye

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions