Closed
Description
The ImageGrid
class claims to be able to work with any Axes
sub-class, but this is not the case:
import numpy as np
from matplotlib.axes import Axes
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid import ImageGrid
im = np.arange(100)
im.shape = 10, 10
fig = plt.figure(1, (4., 4.))
grid = ImageGrid(fig, 111, # similar to subplot(111)
nrows_ncols = (2, 2), # creates 2x2 grid of axes
axes_pad=0.1, # pad between axes in inch.
axes_class=(Axes, {})
)
for i in range(4):
grid[i].imshow(im)
plt.show()
The error is:
Traceback (most recent call last):
File "t.py", line 13, in <module>
axes_class=(Axes, {})
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/mpl_toolkits/axes_grid1/axes_grid.py", line 647, in __init__
self.set_label_mode(label_mode)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/mpl_toolkits/axes_grid1/axes_grid.py", line 422, in set_label_mode
_tick_only(ax, bottom_on=True, left_on=False)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/mpl_toolkits/axes_grid1/axes_grid.py", line 36, in _tick_only
ax.axis["bottom"].toggle(ticklabels=bottom_off, label=bottom_off)
TypeError: 'method' object is not subscriptable
In fact, it looks like it might be expecting an AxisArtist instance. Should the docstring be updated, or should this be treated as a bug?