-
Notifications
You must be signed in to change notification settings - Fork 21
First pass at a SkyCoord plotting method. #209
Conversation
I was just looking for a feature like this in the docs and then went to open an issue to request it. Seems you've started already. Thanks! |
@astrofrog I added tests, does this need anything else? |
ax.set_ylim(-0.5, 720.5) | ||
|
||
c = SkyCoord(359.76045223*u.deg, 0.26876217*u.deg) | ||
ax.plot_coord(c, 'o', transform=ax.get_transform('galactic')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This demonstrates that the transform always wins. I am not sure this is actually the behaviour we want though right?!
What about converting the frame to the transform frame?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woah that is confusing. I would say that we should ignore transform
for plot_coord
? (or emit an error that it can't be specified?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not allowing the transform arg would work. Or we could convert the input frame to the transform?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we did that, there would be no point since in the end it gets converted to the image frame, so I'd prefer we just disallow transform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason for it is if we allowed a list of SkyCoords as input, but that won't really work so I will remove it.
ax.set_xlim(-0.5, 720.5) | ||
ax.set_ylim(-0.5, 720.5) | ||
|
||
c = SkyCoord(359.76045223*u.deg, 0.26876217*u.deg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the record these are in galactic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll also need to do a PR to data.astropy.org to add the reference images. I need to write instructions about that...
@@ -3,6 +3,7 @@ | |||
from matplotlib.axes import Axes, subplot_class_factory | |||
from matplotlib.transforms import Affine2D, Bbox, Transform | |||
|
|||
import astropy.coordinates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just import the classes you need (SkyCoord and BaseCoordinateFrame)
elif coord.coord_type == 'latitude': | ||
plot_data.append(frame0.data.lat.to(coord.coord_unit).value) | ||
else: | ||
raise NotImplementedError("Scalar Coordinate Support is Not Implemented.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if you could make this clearer, e.g. 'Coordinates cannot be plotted with this method because the WCS does not represent longitude/latitude'
raise NotImplementedError("Scalar Coordinate Support is Not Implemented.") | ||
|
||
if 'transform' in kwargs.keys(): | ||
raise TypeError("The 'transform' keyword argument is not allowed," |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why TypeError? (just curious)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because:
❯ bob(asdj=8)
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 10216, in default
run_compiled_code(code, self.ctx, None, 'single')
File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 1961, in run_compiled_code
func(code, glb, loc)
File "<xonsh-code>", line 1, in <module>
TypeError: bob() got an unexpected keyword argument 'asdj'
i.e. that's the type of error Python raises for unknown kwarg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I learn stuff every day!
I'll add the image references later, the priority is to get this into the astropy wcsaxes merge. |
First pass at a SkyCoord plotting method.
First pass at a SkyCoord plotting method.
No description provided.