質問編集履歴
1
コード編集(挿入)
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,44 @@
|
|
1
|
+
```python
|
2
|
+
|
3
|
+
コード
|
4
|
+
|
5
|
+
import matplotlib.pyplot as plt
|
6
|
+
|
7
|
+
from mpl_toolkits.mplot3d import Axes3D
|
8
|
+
|
9
|
+
from matplotlib import cm
|
10
|
+
|
11
|
+
from matplotlib.ticker import LinearLocator, FormatStrFormatter
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
fig = plt.figure()
|
16
|
+
|
1
|
-
|
17
|
+
ax = fig.add_subplot(111, projection='3d')
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
x = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5]
|
22
|
+
|
23
|
+
y = [200, 400, 600, 800, 200, 400, 600, 800, 200, 400, 600, 800, 200, 400, 600, 800, 200, 400, 600, 800]
|
24
|
+
|
25
|
+
z = [-0.58, 3.3, -0.19, -1.8, -0.23, -2.1, -1.4, -1.3, 0.37, -1.3, -0.39, -1.3, 1.4, 2.2, 2.2, 1.4, 1.8, 2, 3.2, 0.47]
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
ax.scatter(x, y, z, c='r', label='test')
|
30
|
+
|
31
|
+
ax.legend()
|
32
|
+
|
33
|
+
ax.set_xlabel('X')
|
34
|
+
|
35
|
+
ax.set_ylabel('Y')
|
36
|
+
|
37
|
+
ax.set_zlabel('Z')
|
38
|
+
|
39
|
+
plt.show()
|
40
|
+
|
41
|
+
```
|
2
42
|
|
3
43
|
x,y,zのセットを3D図にプロットしたものを表示しています。
|
4
44
|
|