Quantcast
Channel: Uncategorized - Matplotlib
Viewing all articles
Browse latest Browse all 51

Legend with location set to 'best' collides with the title when the titles is moved down

$
0
0

Hi:

I’m adjusting the y-position of a plot title. Then, I add a legend with loc set to ‘best’. However, the legend is placed on top of the title.

The following code demonstrates the issue:

import matplotlib.pyplot as plt

plt.close('all')
plt.plot((1,2,3), label='Just a very long legend')
plt.title('Just a very long title 1234567890', y=0.9)
plt.legend(loc='best')
plt.show()

foo

Is this a bug in legend, or am I missing something? Any advice on how to place the legend using loc=best without colliding with the title?

4 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 51