util

Utility functions.

Functions

calc_aspect(ax)

Calculate the aspect ratio of the axes.

layout_corner_insets(num_insets[, corner, ...])

Lay out positions for n inset plots in a specified corner.

set_aspect(ax, aspect)

Adjust the ratio between ylim span length and xlim span length.

Classes

NamedFrames

Class to provide named frames for OutsetGrid initializer,

SplitKwarg

Wraps a kwarg value that should take on distinct values for 'source' and 'outset' axes when maping or broadcasting over an outset.OutsetGrid.

calc_aspect(ax: Axes) float[source]

Calculate the aspect ratio of the axes.

layout_corner_insets(num_insets: int, corner: Literal['NE', 'NW', 'SE', 'SW'] = 'NE', *, inset_grid_size: Tuple[float, float] | float = 0.5, inset_margin_size: Tuple[float, float] | float = 0.1, inset_pad_ratio: Tuple[float, float] | float = 0.1, transpose: bool = False) List[Tuple[float, float, float, float]][source]

Lay out positions for n inset plots in a specified corner.

The frames are filled from the chosen corner outwards, filling successive diagonals perpendicular to the cornder. Inset subfigure positions are ordered so that inset number increases left-to-right, top-to-bottom.

Parameters:
  • num_insets (int) – The number of inset plots to be generated.

  • corner (Literal["NE", "NW", "SE", "SW"], default "NE") – The corner of the grid where the insets will be positioned.

  • inset_margin_size (Union[Tuple[float, float], float], default 0.5) – How far should grid be spaced from source plot boundaries, relative to the source plot size?

  • inset_grid_size (Union[Tuple[float, float], float], default 0.5) – The size of the grid of inset plots relative to the source plot.

  • inset_pad_ratio (Union[Tuple[float, float], float], default 0.1) – Pad size between inset plots as a fraction of inset plot size.

  • transpose (bool, default False) – Should inset grid layout be ordered top-to-bottom, left-to-right?

Returns:

A list of tuples, each representing (x, y, width, height) of an inset plot fractionally relative to source plot axes.

Return type:

List[Tuple[float, float, float, float]]

See also

outset.util.inset_outsets

Manipulates plot structure to apply corner inset layout calculated by layout_corner_insets, placing outset plots in specified positions over the source plot axes.

class NamedFrames[source]

Class to provide named frames for OutsetGrid initializer,

set_aspect(ax: Axes, aspect: float) None[source]

Adjust the ratio between ylim span length and xlim span length.

The function calculates the current aspect ratio of the Axes object and adjusts its x-axis or y-axis limits to match the desired aspect ratio. If the desired aspect ratio is less than the current, the function increases the width of the x-axis. If it is greater, the height of the y-axis is increased.

Note that axes limits are only ever extended. Data limit extension is performed symmetrically.

class SplitKwarg[source]

Wraps a kwarg value that should take on distinct values for ‘source’ and ‘outset’ axes when maping or broadcasting over an outset.OutsetGrid.

source

The value of the argument to be used in the ‘source’ context.

Type:

Any

outEDset

The value of the argument to be used in the ‘outset’ context.

Type:

Any

source: Any
outset: Any
__init__(source: Any, outset: Any) None
__repr__()

Return repr(self).