Open keflavich opened 8 years ago
Snippet example:
scalebar_right = coordinates.SkyCoord("19h23m40s", "14d29m45s", frame='fk5')
length = (0.5*u.pc / (5400*u.pc)).to(u.deg, u.dimensionless_angles())
ax.plot([scalebar_right.ra.deg, (scalebar_right.ra-length).deg]*u.deg,
[(scalebar_right.dec).deg]*2*u.deg,
'k',
transform=tr_fk5,
zorder=100, linewidth=2)
ax.text((scalebar_right.ra-length/2).deg, (scalebar_right.dec+0.001*u.deg).deg,
"0.5 pc", color='k', transform=tr_fk5, ha='center')
@keflavich - can we make a Scalebar class that would be a matplotlib Patch subclass? (and it could take the WCS as an argument)
Just to clarify, I think it would be great to do:
from wcsaxes import Scalebar
# create WCSAxes here
ax.add_patch(Scalebar(location='bottom-right', length=3 * u.arcsec,
wcs=wcs, pad=0.1, label='300 au'))
And this would place it at (0.9, 0.1) in relative axis units and figure out the right length?
I like the idea. Won't implement it until I desperately need it, though.
DDD = desperation driven development
It's all in the title. I'm sure I've done this once or twice, so I'll try to include a snippet...