Image#

class aastex.Image(name, figure=None, source=None, args=(), kwargs=<factory>)[source]#

Bases: object

An image file which needs to live in the build directory next to the .tex file which references it.

Images are written by Document.generate_pdf() instead of when they are added to a Figure, since the build directory is not known until the document is compiled.

Instances are created by Figure.add_fig() and Figure.add_image() rather than directly, and the images belonging to a figure or a whole document can be inspected using Figure.images and Document.images.

Attributes

args

Extra arguments passed to matplotlib.figure.Figure.savefig().

figure

A matplotlib figure to save, if this image is generated.

source

The current location of this image, if it is an existing file.

name

The name of this image inside the build directory.

kwargs

Extra keyword arguments passed to matplotlib.figure.Figure.savefig().

Methods

__init__(name[, figure, source, args, kwargs])

is_same_file(other)

Whether this image and other are the same file on disk.

write(directory)

Save or copy this image into directory and return its new location.

Inheritance Diagram

Inheritance diagram of aastex.Image
Parameters:
is_same_file(other)[source]#

Whether this image and other are the same file on disk.

Two generated images are never the same file, since each is saved from its own matplotlib figure.

Parameters:

other (Image)

Return type:

bool

write(directory)[source]#

Save or copy this image into directory and return its new location.

Parameters:

directory (Path)

Return type:

Path

args: tuple = ()#

Extra arguments passed to matplotlib.figure.Figure.savefig().

figure: None | Figure = None#

A matplotlib figure to save, if this image is generated.

kwargs: dict#

Extra keyword arguments passed to matplotlib.figure.Figure.savefig().

name: str#

The name of this image inside the build directory.

source: None | Path = None#

The current location of this image, if it is an existing file.