The Axes Classes

Retina provides Fovea2D and Fovea3D axes which subclass the generic Matplotlib Axes class. As such, the various Fovea Axes retain all of the functionality of the Matplotlib Axes while at the same time providing support for the attaching and handling of layers.

Additionally, the Fovea abstract class provides a generic template specifying those methods which must be implemented by all subclasses of the various Fovea Axes types.

The Fovea2D Class

The Fovea2D class implements an Axes type to which Layer2D instances can be attached and on top of which they can be built.

Class-Level Properties

name: The string specifying the projection type of the Axes.

Developer Note To be brief, Axes in Matplotlib are generated by a projection_registry class which generates Axes instances based on a projection argument provided. Since the Fovea Axes are not native to Matplotlib we use the name attribute to specify our own unique projection identifier. The value of the string is irrelevant so long as the choice stays consistent across the package. For the sake of your sanity, we advise that you leave this value unchanged.

Class-Level Methods

None at this time.

Instance-Level Properties

layers: A dictionary of Layer2D objects attached to the axes. active_layer: The currently active layer. tracker: The diagnostic tracker object associated with the axes.

Instance-Level Methods

__init__(self, *args, **kwargs): Instantiates the class. *args and **kwargs are passed to the Matplotlib Axes constructor. Please see the Matplotlib documentation for a description of the possible values.

add_layer(layer, **kwargs): Instantiates a new Layer2D object with a name passed as the layer argument. **kwargs are passed to the Layer2D constructor.

get_layer(layer): Returns the layer with the given name, provided that such a layer is attached to the Axes.

save_layer(layer, *args, **kwargs): Saves a snapshot of the artists in the layer with name layer to an image file or pdf. *args and **kwargs are passed to the matplotlib.pyplot.savefig() function.

showcase(layer): Showcases the given layer by setting that layer to visible while hiding all other layers associated with the Axes.

delete_layer(layer): Deletes both the layer object and the Axes' reference to it.

build_layer(layer=None, *args, **kwargs): Builds and renders a single Axes layer. This method must be called after applying certain changes to a layer object, such as setting its style. The most iimportant kwarg is plot which specifies the pyplot function used to plot the layer data. plot defaults to the default pyplot.plot() function.

build_layers(): Builds all layers attached to the Axes using the default pyplot.plot() function.

The Fovea3D Class

The 3D analogue of the Fovea2D class. It inherits from Fovea2D and implements all of the methods defined therein. It also subclasses the Matplotlib Axes3D class rather than the more general Axes class.