astrofrog / wcsaxes

wcsaxes has been merged into astropy!
http://docs.astropy.org/en/stable/visualization/wcsaxes/index.html
22 stars 21 forks source link

Make WCSAxes work with matplotlib ImageGrid #135

Open cdeil opened 10 years ago

cdeil commented 10 years ago

As discussed in https://github.com/astropy/pyregion/pull/49 , WCSAxes apparently doesn't work with maplotlib ImageGrid.

E.g. running https://github.com/cdeil/pyregion/blob/issue-49/examples/demo_region03.py with Python 3.4 and matplotlib 1.4.2 results in this error:

$ python demo_region03.py 
Traceback (most recent call last):
  File "demo_region03.py", line 43, in <module>
    axes_class=(WCSAxes, dict(wcs=wcs)))
  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 425, in set_label_mode
    _tick_only(ax, bottom_on=False, 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

It should work like this: http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#imagegrid

astrofrog commented 10 years ago

I just looked into it and it's a Matplotlib bug: https://github.com/matplotlib/matplotlib/issues/3750#issuecomment-61393569 - not clear if it will be fixed or if ImageGrid will be constrained only to specific axes types.