Skip to content

Commit 2595ce3

Browse files
committed
Small update on 5 steps to n body simulation animation
1 parent 2e6620c commit 2595ce3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

5_steps_to_n_body_simulation/extra.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Animations generally consists of two steps:
110110
Since you already know how to generate the frames, we
111111
have already solved the first step. First, let us
112112
copy `step5.py` to `extra.py` and modify it slightly to include
113-
`solar_system_plus`. We also need to import `matplotlib`.
113+
`solar_system_plus`.
114114

115115
??? Note "Code (Click to expand)"
116116
```python title="extra.py"
@@ -208,6 +208,7 @@ Note that we need to set the min and max values for the axes.
208208
if legend:
209209
ax.legend(loc="center right", bbox_to_anchor=(1.325, 0.5))
210210
fig.subplots_adjust(right=0.7)
211+
fig.tight_layout()
211212

212213
plt.savefig(FRAMES_DIR / f"frames_{n:05d}.png")
213214
plt.close("all")
@@ -250,7 +251,7 @@ animation is done, we delete all frames by using `Path.unlink()`.
250251

251252
You should see the animation:
252253

253-
<iframe width="560" height="315" src="https://www.youtube.com/embed/qtCLYpzPxBM?si=p-xXf4mE0DGPLxOS" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
254+
<iframe width="560" height="315" src="https://www.youtube.com/embed/8y9CubaVGLk?si=G1XDDJ8SgQ9qK4OS" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
254255

255256
## Conclusion
256257

5_steps_to_n_body_simulation/python/extra.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ def main() -> None:
257257
if legend:
258258
ax.legend(loc="center right", bbox_to_anchor=(1.325, 0.5))
259259
fig.subplots_adjust(right=0.7)
260+
fig.tight_layout()
260261

261262
plt.savefig(FRAMES_DIR / f"frames_{n:05d}.png")
262263
plt.close("all")

0 commit comments

Comments
 (0)