回答編集履歴
1
修正
answer
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
[matplotlib.animation.FuncAnimation — Matplotlib 3.3.1 documentation](https://matplotlib.org/3.3.1/api/_as_gen/matplotlib.animation.FuncAnimation.html)
|
5
5
|
|
6
|
+
## テキストパース部分
|
6
7
|
|
7
8
|
```python
|
8
9
|
import re
|
@@ -32,6 +33,8 @@
|
|
32
33
|
data.append({"time": time, "color": color, "x": x, "y": y, "z": z})
|
33
34
|
```
|
34
35
|
|
36
|
+
## アニメーション作成部分
|
37
|
+
|
35
38
|
```python
|
36
39
|
fig = plt.figure(figsize=(9, 9))
|
37
40
|
ax = fig.add_subplot(projection="3d")
|
@@ -39,6 +42,7 @@
|
|
39
42
|
ax.set_ylim(-2.5, 2.5)
|
40
43
|
ax.set_zlim(-2.5, 2.5)
|
41
44
|
|
45
|
+
# 空の散布図とタイトルオブジェクトを作成しておく。
|
42
46
|
scatter = ax.scatter([], [], [], c="b")
|
43
47
|
title = ax.set_title("")
|
44
48
|
|
@@ -56,7 +60,7 @@
|
|
56
60
|
scatter._facecolor3d = sample["color"]
|
57
61
|
scatter._edgecolor3d = sample["color"]
|
58
62
|
|
59
|
-
|
63
|
+
# アニメーションを作成する。
|
60
64
|
anim = FuncAnimation(fig, update, data, interval=100)
|
61
65
|
anim.save("anim.gif", writer="pillow")
|
62
66
|
```
|