回答編集履歴
1
修正
test
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
`add_subplot()` で作成した Axes を `ax = fig.add_subplot(
|
1
|
+
`add_subplot()` で作成した Axes を `ax = fig.add_subplot()` と変数に保存しておき、描画するときは、Axes の plot() を呼び出すように変更しましょう。
|
2
2
|
|
3
3
|
|
4
4
|
|
5
5
|
```python
|
6
6
|
|
7
7
|
import matplotlib.pyplot as plt
|
8
|
+
|
9
|
+
import numpy as np
|
8
10
|
|
9
11
|
|
10
12
|
|
@@ -51,3 +53,15 @@
|
|
51
53
|
plt.show()
|
52
54
|
|
53
55
|
```
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
![イメージ説明](6f83ca421b0872774eab856b8cf9ca7e.png)
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
plt.subplots()、plt.figure() 以外の plt.<関数名> といった関数は[ステートフル](http://e-words.jp/w/%E3%82%B9%E3%83%86%E3%83%BC%E3%83%88%E3%83%95%E3%83%AB.html) インタフェースであるということを理解した上で使わないと、混乱の原因になるので、基本的には使わないほうがいいでしょう。
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
[Python - matplotlibを用いた異なるウィンドウ間でのインタラクティブプロット|teratail](https://teratail.com/questions/177206)
|