Closed
Description
Bug summary
When using a polar coordinate system the plot title overlaps with the axis labels. This worked in 3.9.4 and broke with 3.10.0. This commit broke it: 8abe308 via #28300
Code for reproduction
import matplotlib.pyplot as plt
plt.polar([0, 1], [0, 1])
plt.title('My Title')
plt.savefig('output.png')
Actual outcome
The title overlaps the axis labels
Expected outcome
The title should be above the axis labels
Additional information
- This bug happens with the new 3.10 version, but with the 3.9.4 version
I performed a git bisect using this:
git bisect start
git bisect good v3.9.4
git bisect bad HEAD
a small test script check.py
- there's probably a better way, but that's what I came up with. (Note that the issues also comes up when not using `bbox_inches='tight', but this way it was easier to bisect, since I could instrument the image size)
import matplotlib.pyplot as plt
from PIL import Image
def main():
plt.polar([0, 1], [0, 1])
plt.title('My Title')
plt.savefig('output.png', bbox_inches='tight')
with Image.open('output.png') as img:
size = img.size
if size != (453, 464):
return 1
else:
return 0
if __name__ == '__main__':
raise SystemExit(main())
finally,
git bisect run python3 check.py
After a few steps it yielded this suspicious commit: 8abe308 (cc @rcomer) which was merged in #28300
Operating system
Ubuntu 22.04
Matplotlib Version
3.10.0.dev1180+gc2d502d219
Matplotlib Backend
agg
Python version
3.13.1
Jupyter version
No response
Installation
git checkout