関数呼び出し draw があります。2 つのリストがあり、1 つは x 座標、もう 1 つは y 座標です。プロットを作成していますが、プロットに x、y 座標を書きたいと思っています。annotate が答えかもしれませんが、リストを取得できません。私はこれをやろうとしています:
def draw(LuxCoordinates, finalPix, verName, GraphNum):
xy = (LuxCoordinates,finalPix)
plt.axes([0.1, 0.1, 0.6, 0.8]);
plt.xlim(0,3100,);
plt.ylim(0,100,100);
plt.xticks(arange(0,3500,350)) #spaces of x axis
plt.yticks(arange(0,100,10)) #spaces of y axis
if GraphNum == 1:
plt.plot(LuxCoordinates, finalPix, 'r', label=verName);
if GraphNum == 2:
plt.plot(LuxCoordinates, finalPix, 'g', label=verName);
if GraphNum == 3:
plt.plot(LuxCoordinates, finalPix, 'b', label=verName);
legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
plt.scatter(LuxCoordinates, finalPix, linewidths=1)
**for i, txt in enumerate(xy):
plt.annotate(txt, (LuxCoordinates[i],finalPix[i]))**
plt.grid(axis)
plt.xlabel('Ambient', color='r');
plt.ylabel('Depth Grows', color='r'); # grayscale color
plt.title(PngName, color='b');
savefig(PngName+'_'+date+'_'+currentime+'.png')
しかし、私はこれを得ています:
ズームイン:
何かを書いているのがわかりますが、それはすべて最初のポイントのリストです。各 x、y がポイントの近くに個別に書き込まれるようにするため、青いグラフの最初のポイントは 0.96.6 になります。 、緑色では 0、93.54 になります (2 つのリストが表示されます)
誰かが私を助けてくれますか?ありがとう!