13.annotate - wwj-2017-1117/graph GitHub Wiki

import matplotlib.pyplot as plt import numpy as np

使用annotate标注文字

x = np.arange(0, 6) y = x * x plt.plot(x, y, marker='o') for xy in zip(x, y): plt.annotate("(%s,%s)" % xy, xy=xy, xytext=(-20, 10), textcoords='offset points') plt.show()

print(np.zeros(np.shape([1, 2, 3, 4]))) # [0. 0. 0. 0.]