Open
Description
Bug summary
If I adjust the y-position of a plot title to move it down, and then I add a legend with loc set to best
, the legend overlaps with the title.
Code for reproduction
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()
Actual outcome
Expected outcome
I expect the legend to be placed in a location that does not overlap with the title.
Additional information
No response
Operating system
Linux
Matplotlib Version
3.9.4
Matplotlib Backend
qtagg
Python version
3.12.7
Jupyter version
No response
Installation
pip