Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cgarciae/dyn_plot
https://github.com/cgarciae/dyn_plot
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/cgarciae/dyn_plot
- Owner: cgarciae
- License: apache-2.0
- Created: 2024-06-19T21:47:19.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-12T07:04:13.000Z (4 months ago)
- Last Synced: 2024-10-14T11:39:56.452Z (about 1 month ago)
- Language: Jupyter Notebook
- Size: 105 KB
- Stars: 13
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dyn_plot
Create `matplotlib` figures that can be easily updated at runtime in Jupyter.
```python
import numpy as np
from dyn_plot import Plot# accepts all plt.figure() arguments
plot = Plot(figsize=(10, 5))ts = np.linspace(0, 10, 200)
losses = []
for t in ts:
loss = -np.log(t + 0.001) + np.random.normal() * 0.4
losses.append(loss)with plot: # clear and redraw
# use any methods from Axes
plot.set_title(f't = {t:.2f}')
plot.plot(losses)# close to avoid an additional rendering of the inner figure
plot.close()
```![dyn plot video](https://github.com/cgarciae/dyn_plot/assets/5862228/5e2ecf91-5ee8-418a-9317-01ff390a8f31)