CoordinateHelper

class wcsaxes.CoordinateHelper(parent_axes=None, parent_map=None, transform=None, coord_index=None, coord_type='scalar', coord_unit=None, coord_wrap=None, frame=None)[source]

Bases: object

Attributes Summary

formatter
locator

Methods Summary

display_minor_ticks(display_minor_ticks) Display minor ticks for this coordinate.
format_coord(value) Given the value of a coordinate, will format it according to the format of the formatter_locator.
get_axislabel() Get the text for the axis label
get_minor_frequency()
grid([draw_grid, grid_type]) Plot grid lines for this coordinate.
set_axislabel(text[, minpad]) Set the text and optionally visual properties for the axis label.
set_axislabel_position(position) Set where axis labels should appear
set_coord_type(coord_type[, coord_wrap]) Set the coordinate type for the axis.
set_format_unit(unit) Set the unit for the major tick labels.
set_major_formatter(formatter) Set the formatter to use for the major tick labels.
set_minor_frequency(frequency) Set the frequency of minor ticks per major ticks.
set_separator(separator) Set the separator to use for the angle major tick labels.
set_ticklabel(**kwargs) Set the visual properties for the tick labels.
set_ticklabel_position(position) Set where tick labels should appear
set_ticklabel_visible(visible) Set whether the tick labels are visible or not.
set_ticks([values, spacing, number, size, ...]) Set the location and properties of the ticks.
set_ticks_position(position) Set where ticks should appear
set_ticks_visible(visible) Set whether ticks are visible or not.

Attributes Documentation

formatter
locator

Methods Documentation

display_minor_ticks(display_minor_ticks)[source]

Display minor ticks for this coordinate.

Parameters:

display_minor_ticks : bool

Whether or not to display minor ticks.

format_coord(value)[source]

Given the value of a coordinate, will format it according to the format of the formatter_locator.

get_axislabel()[source]

Get the text for the axis label

Returns:

label : str

The axis label

get_minor_frequency()[source]
grid(draw_grid=True, grid_type='lines', **kwargs)[source]

Plot grid lines for this coordinate.

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.

set_axislabel(text, minpad=1, **kwargs)[source]

Set the text and optionally visual properties for the axis label.

Parameters:

text : str

The axis label text.

minpad : float, optional

The padding for the label in terms of axis label font size.

kwargs

Keywords are passed to matplotlib.text.Text. These can include keywords to set the color, size, weight, and other text properties.

set_axislabel_position(position)[source]

Set where axis labels should appear

Parameters:

position : str

The axes on which the axis label for this coordinate should appear. Should be a string containing zero or more of 'b', 't', 'l', 'r'. For example, 'lb' will lead the axis label to be shown on the left and bottom axis.

set_coord_type(coord_type, coord_wrap=None)[source]

Set the coordinate type for the axis.

Parameters:

coord_type : str

One of ‘longitude’, ‘latitude’ or ‘scalar’

coord_wrap : float, optional

The value to wrap at for angular coordinates

set_format_unit(unit)[source]

Set the unit for the major tick labels.

Parameters:

unit : class:Unit

The unit to which the tick labels should be converted to.

set_major_formatter(formatter)[source]

Set the formatter to use for the major tick labels.

Parameters:

formatter : str or Formatter

The format or formatter to use.

set_minor_frequency(frequency)[source]

Set the frequency of minor ticks per major ticks.

Parameters:

frequency : int

The number of minor ticks per major ticks.

set_separator(separator)[source]

Set the separator to use for the angle major tick labels.

Parameters:

separator : The separator between numbers in sexagesimal

representation. Can be either a string or a tuple.

set_ticklabel(**kwargs)[source]

Set the visual properties for the tick labels.

Parameters:

kwargs

Keyword arguments are passed to matplotlib.text.Text. These can include keywords to set the color, size, weight, and other text properties.

set_ticklabel_position(position)[source]

Set where tick labels should appear

Parameters:

position : str

The axes on which the tick labels for this coordinate should appear. Should be a string containing zero or more of 'b', 't', 'l', 'r'. For example, 'lb' will lead the tick labels to be shown on the left and bottom axis.

set_ticklabel_visible(visible)[source]

Set whether the tick labels are visible or not.

Parameters:

visible : bool

The visibility of ticks. Setting as False will hide this coordinate’s tick labels.

set_ticks(values=None, spacing=None, number=None, size=None, width=None, color=None, alpha=None, exclude_overlapping=False)[source]

Set the location and properties of the ticks.

At most one of the options from values, spacing, or number can be specified.

Parameters:

values : iterable, optional

The coordinate values at which to show the ticks.

spacing : float, optional

The spacing between ticks.

number : float, optional

The approximate number of ticks shown.

size : float, optional

The length of the ticks in points

color : str or tuple

A valid Matplotlib color for the ticks

exclude_overlapping : bool, optional

Whether to exclude tick labels that overlap over each other.

set_ticks_position(position)[source]

Set where ticks should appear

Parameters:

position : str

The axes on which the ticks for this coordinate should appear. Should be a string containing zero or more of 'b', 't', 'l', 'r'. For example, 'lb' will lead the ticks to be shown on the left and bottom axis.

set_ticks_visible(visible)[source]

Set whether ticks are visible or not.

Parameters:

visible : bool

The visibility of ticks. Setting as False will hide ticks along this coordinate.