You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Creating a figure of size (0, 0) raises an error #16687
Traceback (most recent call last):
File "test_mpl.py", line 3, in <module>
fig = plt.figure(figsize=(0,0))
File "/Users/kkolman/anaconda3/envs/sift/lib/python3.7/site-packages/matplotlib/pyplot.py", line 546, in figure
**kwargs)
File "/Users/kkolman/anaconda3/envs/sift/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 3324, in new_figure_manager
fig = fig_cls(*args, **kwargs)
File "/Users/kkolman/anaconda3/envs/sift/lib/python3.7/site-packages/matplotlib/figure.py", line 349, in __init__
raise ValueError('figure size must be positive finite not '
ValueError: figure size must be positive finite not (0, 0)
Expected outcome
The code above used to not raise an error in the previous version of matplotlib.
This looks like it was an intentional change (see #13859) to avoid crashes down-stream when trying to save 0 sized images into png. We didn't put an API change note in for this because it was a bug fix and we did not think there was a valid use of a 0 size figure in the wild.
Given that @djhoese gitter you said this was a test making sure your code behaved correctly in the case of nonsensical input I hope that you can just stoy worrying about that case ;)
Is there a use-case for a 0 size figure? If there is not, I propose closing this as no-action (or maybe add a retro-active API change notice).
Not that I know of but I'm definitely not the person who should have the final answer on that. I could see someone doing it for testing but at that point just make a 1x1 image if you need to.
I would say this is not an issue for my team anymore. We removed the test which itself was a test of another thing that was nonsensical. Feel free to close.
Activity
djhoese commentedon Mar 5, 2020
This was brought up on gitter as something that maybe shouldn't be raising an error.
tacaswell commentedon Mar 5, 2020
This looks like it was an intentional change (see #13859) to avoid crashes down-stream when trying to save 0 sized images into png. We didn't put an API change note in for this because it was a bug fix and we did not think there was a valid use of a 0 size figure in the wild.
Given that @djhoese gitter you said this was a test making sure your code behaved correctly in the case of nonsensical input I hope that you can just stoy worrying about that case ;)
Is there a use-case for a 0 size figure? If there is not, I propose closing this as no-action (or maybe add a retro-active API change notice).
Thank you for reporting this @katherinekolman
djhoese commentedon Mar 5, 2020
Not that I know of but I'm definitely not the person who should have the final answer on that. I could see someone doing it for testing but at that point just make a 1x1 image if you need to.
I would say this is not an issue for my team anymore. We removed the test which itself was a test of another thing that was nonsensical. Feel free to close.
QuLogic commentedon Jun 16, 2020
This is now actually allowed from #17610.