ojipadeson
ojipadeson

Reputation: 191

How to change the length of the symbol of legend in matplotlib drawing?

In the legend I drew, the dashed symbol is a little bit longer, as follows(in blue circle): a little longer symbeol How to reduce that extra bit?

Upvotes: 0

Views: 333

Answers (1)

Paul Brodersen
Paul Brodersen

Reputation: 13041

The relevant parameter is called handlelength:

enter image description here

plt.plot(range(5), range(5), label='lorem ipsum')
plt.legend(handlelength=10)
plt.show()

Upvotes: 1

Related Questions