matplotlib图例中符号左侧的文本

Mal*_*lik 3 python matplotlib legend

是否有任何内置函数/方法或简洁的方法将文本放在图例中标记/符号的左侧?

you*_*nda 5

this can be done by setting the parameter markerfirstof the matplotlib.pyplot.legend to False.

markerfist : bool 如果为 True,则图例标记放置在图例标签的左侧。如果为 False,图例标记将放置在图例标签的右侧。默认值为真。

类似的东西:

t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)

fig, ax = plt.subplots()
ax.plot(t, s, label='sine')
ax.legend(markerfirst=False)

plt.show()
Run Code Online (Sandbox Code Playgroud)

我希望这就是你要找的:)