axes_grid.py 942 B

123456789101112131415161718192021222324252627282930
  1. from __future__ import (absolute_import, division, print_function,
  2. unicode_literals)
  3. import mpl_toolkits.axes_grid1.axes_grid as axes_grid_orig
  4. from .axes_divider import LocatableAxes
  5. class CbarAxes(axes_grid_orig.CbarAxesBase, LocatableAxes):
  6. def __init__(self, *kl, **kwargs):
  7. orientation=kwargs.pop("orientation", None)
  8. if orientation is None:
  9. raise ValueError("orientation must be specified")
  10. self.orientation = orientation
  11. self._default_label_on = False
  12. self.locator = None
  13. super(LocatableAxes, self).__init__(*kl, **kwargs)
  14. def cla(self):
  15. super(LocatableAxes, self).cla()
  16. self._config_axes()
  17. class Grid(axes_grid_orig.Grid):
  18. _defaultLocatableAxesClass = LocatableAxes
  19. class ImageGrid(axes_grid_orig.ImageGrid):
  20. _defaultLocatableAxesClass = LocatableAxes
  21. _defaultCbarAxesClass = CbarAxes
  22. AxesGrid = ImageGrid