在我的图表中,我有一条根据原子序数给出电负性的曲线。我希望从门捷列夫库给出的每个值开始一个箭头,精确给出电负性的值。 我不想一一写出箭头,而是自动完成。
from mendeleev import element
import matplotlib.pyplot as plt
x, y = range(1,108), [element(i).en_pauling for i in range(1,108)]
for i in range(1,108):
print(x[i-1], y[i-1])
plt.figure()
plt.plot(x, y)
plt.xticks([0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 108])
plt.yticks([0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5])
plt.xlim(0,108)
plt.ylim(0,5)
plt.grid()
plt.savefig("En_pauling.png")
plt.xlabel("Le numéro atomique Z")
plt.ylabel("Electronégativité selon Pauling")
plt.title("Evolution de l'électronégativité selon Pauling des 108 premiers éléments")
plt.plot(x,y,color='purple', marker = '+')
plt.plot(x, y, 'c')
plt.annotate('Carbone EN=2.6', xy=(6, 2.55), xytext=(25, 4.25),
arrowprops={'facecolor':'black', 'shrink':0.05} )
plt.annotate('Fer EN=1.83', xy=(26, 1.83), xytext=(30, 3.25),
arrowprops={'facecolor':'black', 'shrink':0.05} )
plt.annotate('Or EN=2.6', xy=(79, 2.54), xytext=(80, 3.5),
arrowprops={'facecolor':'black', 'shrink':0.05} )
plt.show()