Browse files

implemented @astrofrog's suggested hack

  • Loading branch information...
1 parent ae6fae7 commit 02ecd5386f7d3a93ca8e60c3db2b34ff3216060a @keflavich committed May 1, 2013
Showing with 8 additions and 2 deletions.
  1. +8 −2 aplpy/aplpy.py
View
10 aplpy/aplpy.py
@@ -284,8 +284,14 @@ def __init__(self, data, hdu=0, figure=None, subplot=(1, 1, 1),
if hasattr(axis,'toggle_axisline'):
self._ax1 = axis
else:
- # doesn't work. self._ax1 = mpltk.HostAxes(axis.get_figure(), axis.get_position())
- raise ValueError('Need a ParasiteAxes / HostAxes axis instance if axis= is specified')
+ # Hack-ish; there must be a better way
+ lower_corner = axis.get_position()[0,:]
+ extent = axis.get_position()[1:] - lower_corner
+ cornerpars = np.concatenate([lower_corner,extent])
+ self._figure = axis.get_figure()
+ self._ax1 = mpltk.HostAxis(self._figure, cornerpars)
+ axis.set_visible(False)
+ self._figure.add_axes(self._ax1)
else:
raise ValueError("subplot= should be either a tuple of three values, or a list of four values")

0 comments on commit 02ecd53

Please sign in to comment.