aloiswei

运行环境:

py3.6
matplotlib 2.1.2

x = [2,4,6,7,8,5,4,3]
y = [3,6,5,8,4,3,2,4]
txt = [\'我\',\'今\',\'晚\',\'上\',\'吃\',\'了\',\'个\',\'鲸\']

import matplotlib.pyplot as plt
plt.rcParams[\'font.sans-serif\']=[\'SimHei\'] #用来正常显示中文标签
plt.scatter(x, y)
for i in range(len(x)):
    plt.annotate(txt[i], xy = (x[i], y[i]), xytext = (x[i]+0.1, y[i]+0.1)) # 这里xy是需要标记的坐标,xytext是对应的标签坐标
plt.show()

PS:感觉好土。。。

分类:

技术点:

相关文章:

  • 2021-09-30
  • 2021-04-14
  • 2021-10-14
  • 2021-06-19
  • 2021-09-10
  • 2022-02-18
猜你喜欢
  • 2021-12-04
  • 2022-12-23
  • 2021-08-27
  • 2021-12-29
  • 2021-12-09
  • 2022-01-08
  • 2021-06-22
相关资源
相似解决方案