| 1 | diff --git a/lib/mpl_toolkits/axes_grid1/axes_grid.py b/lib/mpl_toolkits/axes_grid1/axes_grid.py |
| 2 | --- a/lib/mpl_toolkits/axes_grid1/axes_grid.py |
| 3 | +++ b/lib/mpl_toolkits/axes_grid1/axes_grid.py |
| 4 | @@ -1,5 +1,6 @@ |
| 5 | from numbers import Number |
| 6 | import functools |
| 7 | +from types import MethodType |
| 8 | |
| 9 | import numpy as np |
| 10 | |
| 11 | @@ -7,14 +8,20 @@ |
| 12 | from matplotlib.gridspec import SubplotSpec |
| 13 | |
| 14 | from .axes_divider import Size, SubplotDivider, Divider |
| 15 | -from .mpl_axes import Axes |
| 16 | +from .mpl_axes import Axes, SimpleAxisArtist |
| 17 | |
| 18 | |
| 19 | def _tick_only(ax, bottom_on, left_on): |
| 20 | bottom_off = not bottom_on |
| 21 | left_off = not left_on |
| 22 | - ax.axis["bottom"].toggle(ticklabels=bottom_off, label=bottom_off) |
| 23 | - ax.axis["left"].toggle(ticklabels=left_off, label=left_off) |
| 24 | + if isinstance(ax.axis, MethodType): |
| 25 | + bottom = SimpleAxisArtist(ax.xaxis, 1, ax.spines["bottom"]) |
| 26 | + left = SimpleAxisArtist(ax.yaxis, 1, ax.spines["left"]) |
| 27 | + else: |
| 28 | + bottom = ax.axis["bottom"] |
| 29 | + left = ax.axis["left"] |
| 30 | + bottom.toggle(ticklabels=bottom_off, label=bottom_off) |
| 31 | + left.toggle(ticklabels=left_off, label=left_off) |
| 32 | |
| 33 | |
| 34 | class CbarAxesBase: |