for x,y in zip(x1,y1):
ax1.text(x,y,'%.0f' % y,fontdict={'fontsize':14})
for a,b in zip(df['num'],df['resultRate']):
plt.text(a, b+0.001, '%.4f' % b, ha='center', va= 'bottom',fontsize=9)
Ref1
Ref2
Ref3
import numpy as np
import matplotlib.pyplot as plt
N = 10
data = np.random.random((N, 4))
labels = ['point{0}'.format(i) for i in range(N)]
plt.subplots_adjust(bottom = 0.1)
plt.scatter(
data[:, 0], data[:, 1], marker='o', c=data[:, 2], s=data[:, 3] * 1500,
cmap=plt.get_cmap('Spectral'))
for label, x, y in zip(labels, data[:, 0], data[:, 1]):
plt.annotate(
label,
xy=(x, y), xytext=(-20, 20),
textcoords='offset points', ha='right', va='bottom',
bbox=dict(boxstyle='round,pad=0.5', fc='yellow', alpha=0.5),
arrowprops=dict(arrowstyle = '->', connectionstyle='arc3,rad=0'))
plt.show()
Ref4
import numpy as np; np.random.seed(2)
import matplotlib.pyplot as plt
xy = np.random.rand(10,2)
plt.figure()
for i, ((x,y),) in enumerate(zip(xy)):
plt.text(x,y,i, ha="center", va="center")
plt.show()
|