Open astrofrog opened 13 years ago
I concur, specially since there's already an undocument Compass class in overlays.py! I managed to make it work somehow by minimally adding a missing init function:
def initCompass(self, parent):
self._ax1 = parent._ax1
self._wcs = parent._wcs
self.world2pixel = parent.world2pixel
self.pixel2world = parent.pixel2world
self._initialize_compass()
aplpy.overlays.Compass.__init__ = initCompass
fig.compass = aplpy.overlays.Compass(fig)
fig.compass.show_compass(color='white',
corner=1, # Top-right
length=0.05)
fig.compass._compass[0].set_arrowstyle('-') # Remove head from East arrow
but there's still an issue with the proper location of the compass... You might as well then add my own arrows, but you have to handle the coordinate conversions.
I really want a compass on my image. Does this initialization properly orient N and E (it looks right)? How can I label my arrows?
Unfortunately the Compass
class is removed from overlays.py
in the newer versions of APLpy. @astrofrog, @ycopin, do you happen to know of the least intrusive way to add it back manually?
Something similar to the one used in pywcsgrid2 would be nice.
The Compass class was removed in commit c2221179193de4596248702423133e8fab92261b by @astrofrog. I haven't used Aplpy for a long time, but I think a compass still makes sense along a beam and a scalebar.
The compass class in APLpy was never finished or used, but I agree we should add something back.
Hi all,
I've been working a bit on this and just thought I'd let people know to avoid duplicating effort. What I have done so far is built on AnchoredDirectionArrows which looks like it would bump up the matplotlib requirements to 3. If that's really not a good idea, especially just for adding this feature, let me know and I can start working on something that doesn't use it.
It would be nice to have the ability to automatically plot a N-E compass in one of the corners