Is there any built-in function/method or concise way to bring the text on left side of marker/symbol in legend?
this can be done by setting the parameter markerfirst
of the matplotlib.pyplot.legend
to 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.
Something like that:
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()
I hope this is what you were looking for :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With