CoordinatesMap¶
-
class
astropy.visualization.wcsaxes.
CoordinatesMap
(axes, wcs=None, transform=None, coord_meta=None, slice=None, frame_class=<class 'astropy.visualization.wcsaxes.frame.RectangularFrame'>, previous_frame_path=None)[source] [edit on github]¶ Bases:
object
A container for coordinate helpers that represents a coordinate system.
This object can be used to access coordinate helpers by index (like a list) or by name (like a dictionary).
Parameters: - axes :
WCSAxes
The axes the coordinate map belongs to.
- wcs :
WCS
, optional The WCS for the data. If this is specified,
transform
cannot be specified.- transform :
Transform
, optional The transform for the data. If this is specified,
wcs
cannot be specified.- coord_meta : dict, optional
A dictionary providing additional metadata when
transform
is specified. This should include the keystype
,wrap
, andunit
. Each of these should be a list with as many items as the dimension of the WCS. Thetype
entries should be one oflongitude
,latitude
, orscalar
, thewrap
entries should give, for the longitude, the angle at which the coordinate wraps (andNone
otherwise), and theunit
should give the unit of the coordinates asUnit
instances. This can optionally also include aformat_unit
entry giving the units to use for the tick labels (if not specified, this defaults tounit
).- slice : tuple, optional
For WCS transformations with more than two dimensions, we need to choose which dimensions are being shown in the 2D image. The slice should contain one
x
entry, oney
entry, and the rest of the values should be integers indicating the slice through the data. The order of the items in the slice should be the same as the order of the dimensions in theWCS
, and the opposite of the order of the dimensions in Numpy. For example,(50, 'x', 'y')
means that the first WCS dimension (last Numpy dimension) will be sliced at an index of 50, the second WCS and Numpy dimension will be shown on the x axis, and the final WCS dimension (first Numpy dimension) will be shown on the y-axis (and therefore the data will be plotted usingdata[:, :, 50].transpose()
)- frame_class : type, optional
The class for the frame, which should be a subclass of
BaseFrame
. The default is to use aRectangularFrame
- previous_frame_path :
Path
, optional When changing the WCS of the axes, the frame instance will change but we might want to keep re-using the same underlying matplotlib
Path
- in that case, this can be passed to this keyword argument.
Methods Summary
get_coord_range
()grid
([draw_grid, grid_type])Plot gridlines for both coordinates. set_visible
(visibility)Methods Documentation
-
get_coord_range
()[source] [edit on github]¶
-
grid
(draw_grid=True, grid_type=None, **kwargs)[source] [edit on github]¶ Plot gridlines for both coordinates.
Standard matplotlib appearance options (color, alpha, etc.) can be passed as keyword arguments.
Parameters: - draw_grid : bool
Whether to show the gridlines
- grid_type : { ‘lines’ | ‘contours’ }
Whether to plot the contours by determining the grid lines in world coordinates and then plotting them in world coordinates (
'lines'
) or by determining the world coordinates at many positions in the image and then drawing contours ('contours'
). The first is recommended for 2-d images, while for 3-d (or higher dimensional) cubes, the'contours'
option is recommended. By default, ‘lines’ is used if the transform has an inverse, otherwise ‘contours’ is used.
-
set_visible
(visibility)[source] [edit on github]¶
- axes :