、私は散布マップを取得し、すべてのことを示すのは良いことではありません。
import numpy as np
import matplotlib.pyplot as plt
def function(C,S):
return 2*C+S**2
axis=plt.subplot()
Sand=np.random.rand(50)
Clay=np.random.rand(50)
dc=function(C=Clay,S=Sand)
plt.scatter(Clay,Sand,c=dc,cmap='jet')
axis.set_xlabel('Clay')
axis.set_ylabel('Sand')
enter image description here
だから私は、他の方法.Pcolorまたは関数imshowでそれを表示したいit.So Iを実現するための良い方法です:
import numpy as np
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
axis=plt.subplot()
def function (C,S):
return 2*C+S**2
axis=plt.subplot()
dc=np.ones(50*50).reshape(50,50)
Sand=np.random.rand(50)
Clay=np.random.rand(50)
Clay_or=sorted(Clay)
Sand_or=sorted(Sand,reverse=True)
for i in range(50):
for j in range (50):
result=function(Clay_or[i],Sand_or[j])
dc[j][i]=result
plt.imshow(dc,cmap='jet',extent=(0,1,0,1))
axis.set_xlabel('Clay')
axis.set_ylabel('Sand')
enter image description here
結果は私は、pcolor関数を使用する場合、軸のダニを設定する方法、質問がありますか?
'S'と' C'は1次元配列です - imshowでプロットすることができる行列を得るにはどうすればよいでしょうか? –
'dc.append'コマンドに閉じ括弧がありません –
はい、2次元配列に変換してimshowまたはpcolorしたいのですが、SとCを順番に変更してdcがなくなるとします。 –