WCSAxes

class wcsaxes.WCSAxes(fig, rect, wcs=None, transform=None, coord_meta=None, transData=None, slices=None, frame_class=<class 'wcsaxes.frame.RectangularFrame'>, **kwargs)[source]

Bases: matplotlib.axes.Axes

Methods Summary

draw(renderer[, inframe])
get_coords_overlay(frame[, coord_meta])
get_tightbbox(renderer)
get_transform(frame) Return a transform from the specified frame to display coordinates.
get_xlabel()
get_ylabel()
grid([draw_grid]) Plot gridlines for both coordinates.
imshow(X, *args, **kwargs) Wrapper to Matplotlib’s imshow().
plot_coord(*args, **kwargs) Plot SkyCoord or BaseCoordinateFrame objects onto the axes.
reset_wcs([wcs, slices, transform, coord_meta]) Reset the current Axes, to use a new WCS object.
set_xlabel(label)
set_ylabel(label)

Methods Documentation

draw(renderer, inframe=False)[source]
get_coords_overlay(frame, coord_meta=None)[source]
get_tightbbox(renderer)[source]
get_transform(frame)[source]

Return a transform from the specified frame to display coordinates.

This does not include the transData transformation

Parameters:

frame : WCS or Transform or str

The frame parameter can have several possible types:
  • WCS instance: assumed to be a transformation from pixel to world coordinates, where the world coordinates are the same as those in the WCS transformation used for this WCSAxes instance. This is used for example to show contours, since this involves plotting an array in pixel coordinates that are not the final data coordinate and have to be transformed to the common world coordinate system first.
  • Transform instance: it is assumed to be a transform to the world coordinates that are part of the WCS used to instantiate this WCSAxes instance.
  • 'pixel' or 'world': return a transformation that allows users to plot in pixel/data coordinates (essentially an identity transform) and world (the default world-to-pixel transformation used to instantiate the WCSAxes instance).
  • 'fk5' or 'galactic': return a transformation from the specified frame to the pixel/data coordinates.
  • BaseCoordinateFrame instance.
get_xlabel()[source]
get_ylabel()[source]
grid(draw_grid=True, **kwargs)[source]

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

imshow(X, *args, **kwargs)[source]

Wrapper to Matplotlib’s imshow().

If an RGB image is passed as a PIL object, it will be flipped vertically and origin will be set to lower, since WCS transformations - like FITS files - assume that the origin is the lower left pixel of the image (whereas RGB images have the origin in the top left).

All arguments are passed to imshow().

plot_coord(*args, **kwargs)[source]

Plot SkyCoord or BaseCoordinateFrame objects onto the axes.

The first argument to plot_coord should be a coordinate, which will then be converted to the first two parameters to matplotlib.axes.Axes.plot. All other arguments are the same as matplotlib.axes.Axes.plot. If not specified a transform keyword argument will be created based on the coordinate.

Parameters:

coordinate : SkyCoord or BaseCoordinateFrame

The coordinate object to plot on the axes. This is converted to the first two arguments to matplotlib.axes.Axes.plot.

See also

matplotlib.axes.Axes.plot
This method is called from this function with all arguments passed to it.
reset_wcs(wcs=None, slices=None, transform=None, coord_meta=None)[source]

Reset the current Axes, to use a new WCS object.

set_xlabel(label)[source]
set_ylabel(label)[source]