GeezerVison is showing github.com — bbox_inches='tight' raises KeyError for JPG and TIF · Issue #109 · matplotlib/matplotlib
bbox_inches='tight' raises KeyError for JPG and TIF #109DescriptionThe following script:
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(2,2,1)
ax.scatter([0.5], [0.5])
fig.savefig('test.jpg', bbox_inches='tight')
raises the following exception:
Traceback (most recent call last):
File "tif.py", line 8, in <module>
fig.savefig('test.jpg', bbox_inches='tight')
File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/figure.py", line 1162, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backend_bases.py", line 1943, in print_figure
**kwargs)
File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backend_bases.py", line 1803, in print_jpg
return image.save(filename_or_obj, **options)
File "/Users/tom/Library/Python/2.6/site-packages/PIL/Image.py", line 1423, in save
raise KeyError(ext) # unknown extension
KeyError: ''
and same for TIFF files. If bbox_inches='tight' isn't supported, maybe a warning would be better?
I'm using 5df5830 Activityleejjoon commented on May 11, 2011 The patch is applied to the v1.0.x branch and merged to the master. added a commit that references this issue on Jun 2, 2011This issue will close once commit 8c2647f is merged into the 'master' branch.8c2647f kilojoules commented on Jul 29, 2015 I got this error for .jpeg tacaswell commented on Jul 30, 2015 @kilojoules What version of mpl are you using? If it is 1.4.x please create a new issue with a minimal case to reproduce, if it is older, please upgrade and check if you can reproduce on a current version.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|