I just refactored some custom code to make use of
axes_grid1.ImageGrid, and I think I've come across a bug (see below).
It looks like the tick labelsize doesn't get passed properly to the
parasite axes.
I'm using Python2.6, matplotlib-1.0.0 release, and the Qt4Agg backend.
Also, I noticed that the Grid.__init__ super-class constructor isn't
called in the ImageGrid.__init__ constructor; should it be?
By way of feature request, I'd prefer to be able to specify share_x
and share_y in the constructor, but that's not available in ImageGrid,
only in Grid.
If there's agreement that this is bug, I'll file it on the sourceforge
tracker. Is this fixed in SVN, or does anyone have workaround, e.g.,
some way to convert 'x-small' to the correct integer size, or a
different method to call?
Thanks,
Justin
···
========
from mpl_toolkits.axes_grid1 import ImageGrid
import pylab
import numpy
row_height = 10
fi = pylab.figure()
grid = ImageGrid(fi, 111, nrows_ncols=(5,1), share_all=False, label_mode='l')
for i in range(5):
a = abs(numpy.random.randn(5,100))
im = grid[i].imshow(a)
cb = grid.cbar_axes[0].colorbar(im)
for ax in grid.axes_all:
ax.set_yticks([])
# oops - this only changes the lowest Axes formatting
grid.axes_llc.tick_params(direction='out', labelsize='x-small')
pylab.show()
# Now pan to the left a bit-- you'll see the large 0 from the 100 xtick_label
# Let's try explicitly setting all of the xtick sizes. Kablooie.
for ax in grid.axes_all:
ax.tick_params(direction='out', labelsize='x-small')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/tmp/<ipython console> in <module>()
.../matplotlib/axes.pyc in tick_params(self, axis, **kwargs)
2215 xkw.pop('labelleft', None)
2216 xkw.pop('labelright', None)
-> 2217 self.xaxis.set_tick_params(**xkw)
2218 if axis in ['y', 'both']:
2219 ykw = dict(kwargs)
.../matplotlib/axis.pyc in set_tick_params(self, which, reset, **kw)
795 if which == 'major' or which == 'both':
796 for tick in self.majorTicks:
--> 797 tick._apply_params(**self._major_tick_kw)
798 if which == 'minor' or which == 'both':
799 for tick in self.minorTicks:
.../matplotlib/axis.pyc in _apply_params(self, **kw)
274 if dirpad:
275 self._base_pad = kw.pop('pad', self._base_pad)
--> 276 self.apply_tickdir(kw.pop('tickdir', self._tickdir))
277 trans = self._get_text1_transform()[0]
278 self.label1.set_transform(trans)
.../matplotlib/axis.pyc in apply_tickdir(self, tickdir)
331 else:
332 self._tickmarkers = (mlines.TICKDOWN, mlines.TICKUP)
--> 333 self._pad = self._base_pad + self._size
334
335
TypeError: unsupported operand type(s) for +: 'int' and 'str'