回答編集履歴

2

コード修正

2020/07/15 12:59

投稿

8524ba23
8524ba23

スコア38341

test CHANGED
@@ -26,6 +26,8 @@
26
26
 
27
27
  Z = np.random.normal(1, 0.1, (N, N)) # Zに(224,224)のarrayを与える
28
28
 
29
+ print(type(Z), Z.shape) # <class 'numpy.ndarray'> (224, 224)
30
+
29
31
 
30
32
 
31
33
  fig = plt.figure()
@@ -36,7 +38,7 @@
36
38
 
37
39
  XX, YY = np.meshgrid(X, Y, indexing='ij')
38
40
 
39
- surf = ax.scatter3D(XX, YY, Z, c=Z, cmap=cm.Spectral)
41
+ surf = ax.scatter3D(XX, YY, Z, c=Z.ravel(), cmap=cm.Spectral)
40
42
 
41
43
  fig.colorbar(surf)
42
44
 

1

修正

2020/07/15 12:59

投稿

8524ba23
8524ba23

スコア38341

test CHANGED
@@ -36,10 +36,12 @@
36
36
 
37
37
  XX, YY = np.meshgrid(X, Y, indexing='ij')
38
38
 
39
- surf = ax.plot_surface(XX, YY, Z, cmap=cm.Spectral)
39
+ surf = ax.scatter3D(XX, YY, Z, c=Z, cmap=cm.Spectral)
40
40
 
41
41
  fig.colorbar(surf)
42
42
 
43
43
  plt.show()
44
44
 
45
45
  ```
46
+
47
+ ![イメージ説明](fb3cdc2907f0d062b40542f2f7d716a2.png)