aplpy / aplpy

Astronomical Plotting Library in Python
http://aplpy.github.com
Other
171 stars 82 forks source link

Implement North-East compass #10

Open astrofrog opened 13 years ago

astrofrog commented 13 years ago

It would be nice to have the ability to automatically plot a N-E compass in one of the corners

ycopin commented 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.

abostroem commented 6 years ago

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?

enourbakhsh commented 5 years ago

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.

compass

ycopin commented 5 years ago

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.

astrofrog commented 5 years ago

The compass class in APLpy was never finished or used, but I agree we should add something back.

nbrunett commented 5 years ago

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.