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.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().
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().

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]