-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Legend with location set to ‘best’ overlaps with the title when the titles is moved down #29319
Comments
I'm inclined to close as "won't fix". Titles are not considered data content and thus not taken into account for legend placement. The same would hold true for axis labels. If you want to place text inside the Axes, I propose to use
|
we can do many things for this issue 1 is that we can position the legend outside the fox here is the code for this I have used ` plt.close('all') ` |
Agree with @timhoffm that this is likely a won't fix. If the user wants to place the title in such a non-default location they can also place the legend manually to use a bbox as suggested by @Shivangbijalwan |
Thank you all for your answers. My use case is inside a 2-by-4 subplot, where each subplot has a different legend. For this reason, placing the legend outside the axes is not an option in this case. I'll try using Given that |
I'd go the other way, and in legend document that |
I agree that more detailed documentation of the |
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
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
The text was updated successfully, but these errors were encountered: