Created
July 12, 2022 09:56
-
-
Save grey-area/77823d127d05297ba0e039369c6027d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from pathlib import Path | |
from tqdm import tqdm | |
if __name__ == "__main__": | |
output_dir = Path('frames') | |
output_dir.mkdir(exist_ok=True) | |
xs = np.linspace(0, 4 * np.pi, 200) | |
fig, ax = plt.subplots(1, figsize=(12.8, 7.2)) | |
num_frames = 300 | |
for frame in tqdm(range(num_frames)): | |
ys = np.cos(xs + 0.01 * frame) | |
ax.plot(xs, ys) | |
plt.savefig(output_dir / f'{frame:03d}.png', dpi=100) | |
ax.clear() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment