<分区>
是否有任何内置函数/方法或简洁的方法可以将文本放在图例中标记/符号的左侧?
<分区>
是否有任何内置函数/方法或简洁的方法可以将文本放在图例中标记/符号的左侧?
最佳答案
这可以通过将 matplotlib.pyplot.legend
的参数 markerfirst
设置为 False
来完成。
markerfist : bool If True, legend marker is placed to the left of the legend label. If False, legend marker is placed to the right of the legend label. Default is True.
类似的东西:
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()
我希望这就是您要找的:)
关于python - matplotlib图例中符号左侧的文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54969227/