由于您不想使用,
annotate或
text下一个最好的方法是
py.scatter接受标记
``'$...$'`` render the string using mathtext.
例如
import pylab as pydata = [["peach", 1.0, 1.0], ["apples", 19, 3.5], ["oranges", 7, 2.2], ["grapes", 23, 7.8]]for item in data: py.scatter(item[1], item[2], s=700*item[1], c=(item[2]/10.0, 0, 1 - item[2]/10.0), marker=r"$ {} $".format(item[0]), edgecolors='none' )py.show()此方法有几个问题
textrm{}在数学文本中使用使其不斜体似乎会破坏matplotlib- 字母大小需要手动调整(因此系数为700)
使用颜色表而不是简单地定义RGB颜色值可能会更好。



