plt.xlim((1, 2))
plt.right((1, 2))
plt.xticks([1, 1.2, 1.4, 1.6, 1.8])
plt.yticks(
[-2, -1.8, -1, 1.22, 3],
[r'$really\ bad$', r'$bad$', r'$normal$', r'$good$', r'$really\ good$']
) # 每个 y 值对应一个后面的 label
ax = plt.gca()
ax.spines['top'].set_color('none') # 上方边框不显示
ax.spines['left'].set_position(('data',0))
# 显示图例,不加即默认,放在空位,即 loc='best',也可以全都不写
plt.lagend([l1,l2], ["l1", "l2"], loc=...)
# 文字 xytext 单位为 px
# 图中文字
plt.annotate(r'$2x+1=%s$' % y0, xy=(x0, y0), xycoords='data', xytext=(+30, -30),
textcoords='offset points', fontsize=16,
arrowprops=dict(arrowstyle='->', connectionstyle="arc3,rad=.2"))
# 图外文字
plt.text(-3.7, 3, r'$This\ is\ the\ some\ text. \mu\ \sigma_i\ \alpha_t$',
fontdict={'size': 16, 'color': 'r'})
plt.text(x, y , '%.2f' % y, ha='center', va='bottom') # 水平对齐和垂直对齐
# c: 调节颜色
plt.scatter(X, Y, s=(T + 4) * 10, c=T, alpha=.5)