A regression was introduced from v3.0.0 and v3.0.1 that breaks axes_grid1 with a TypeError: get_tightbbox() got an unexpected keyword argument 'bbox_extra_artists'.
I get the same error in 3.0.1 with inset_axes(). I see that they're supposed to be experimental now, but the code I'm using worked before 3.0.0 (I don't remember if I ran it with 3.0.0 as well).
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
fig = plt.figure()
ax1 = plt.gca()
ax1.plot(np.arange(10))
inset_ax1 = inset_axes(ax1,width="50%",height=0.6)
inset_ax1.plot(np.arange(10))
plt.savefig('inset_axes_test',pad_inches=0,bbox_inches='tight')
Outcome:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/matplotlib/pyplot.py", line 689, in savefig
res = fig.savefig(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 2094, in savefig
self.canvas.print_figure(fname, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/matplotlib/backend_bases.py", line 2053, in print_figure
bbox_extra_artists=bbox_artists)
File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 2276, in get_tightbbox
for ax in self.axes if ax.get_visible())
File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 2276, in <genexpr>
for ax in self.axes if ax.get_visible())
TypeError: get_tightbbox() got an unexpected keyword argument 'bbox_extra_artists'
Activity
jklymak commented on Oct 26, 2018
I cannot reproduce with the code above, thought I didn't try with the inline backend. I do get a wonky looking figure, but I don't throw an error.
jklymak commented on Oct 26, 2018
OK. I see - you forgot to specify fig.savefig("/tmp/tmp.png", box_inches='tight')
tylerharvey commented on Dec 11, 2018
I get the same error in 3.0.1 with inset_axes(). I see that they're supposed to be experimental now, but the code I'm using worked before 3.0.0 (I don't remember if I ran it with 3.0.0 as well).
import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.axes_grid1.inset_locator import inset_axes fig = plt.figure() ax1 = plt.gca() ax1.plot(np.arange(10)) inset_ax1 = inset_axes(ax1,width="50%",height=0.6) inset_ax1.plot(np.arange(10)) plt.savefig('inset_axes_test',pad_inches=0,bbox_inches='tight')Outcome:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.5/dist-packages/matplotlib/pyplot.py", line 689, in savefig res = fig.savefig(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 2094, in savefig self.canvas.print_figure(fname, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backend_bases.py", line 2053, in print_figure bbox_extra_artists=bbox_artists) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 2276, in get_tightbbox for ax in self.axes if ax.get_visible()) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 2276, in <genexpr> for ax in self.axes if ax.get_visible()) TypeError: get_tightbbox() got an unexpected keyword argument 'bbox_extra_artists'I get no bug with bbox_inches=0 or None.
jklymak commented on Dec 11, 2018
I don’t think this was fixed until 3.0.2, but I could be wrong.
The experimental inset_axes is not imported from axes_grid1. It is just a method on axes. I.e. inset = ax1.inset_axes().
tylerharvey commented on Dec 18, 2018
Yep, you're right that it's fixed in 3.0.2.