Description
Bug summary
I recently updated Python from 3.9.x (not sure which one, seem to recall quite low number, maybe 3.9.2-ish?) to 3.9.11.
I was working on drawing shapes to a Matplotlib figure, using primarily figure methods and avoiding axes methods because of the autoscaling feature keeping resizing the axis limits. However, now whenever I plt.show anything, it resizes the figure dimensions!! For example, with a 640x480 figure, I immediately do plt.show() and it resizes the figure to 800x600!!! This results in any centred shapes being moved to the bottom left quadrant!!!
Immediately prior to the plt.show() a ‘print (fig)’ instruction still shows a 640x480 figure (0 Axes), while immediately after it shows a 800x600 figure (still 0 Axes).
What’s going on?!!!?
Code for reproduction
import matplotlib.pyplot as plt
fig = plt.figure()
print (fig)
plt.show()
print (fig)
Actual outcome
========== RESTART: C:/Users/Owner/Documents/Python/3D Pyplot/test2.py =========
Figure(640x480)
Figure(800x600)
Expected outcome
========== RESTART: C:/Users/Owner/Documents/Python/3D Pyplot/test2.py =========
Figure(640x480)
Figure(640x480)
Additional information
Previously worked fine on earlier version of Python 3.9.x (possibly 3.9.2?). Have developed multiple files progressing through various stages of development, but then got bogged down tryng to figure why my maths was wrong and shapes all kept ending up towards bottom left quadrant! Finally boiled it down to this issue.
Have tried various attempts at disabling autoscaling on Axes, and reducing margins etc., but nothing seems to help
Operating system
Windows 10
Matplotlib Version
3.5.1
Matplotlib Backend
TkAgg
Python version
3.9.11
Jupyter version
n/a
Installation
pip