TweakSpreadArea

class TweakSpreadArea[source]

Functor to spread apart a crowded axes area.

The adjustment is applied by moving the vertex away from the centroid of the parametrized x/y limits, scaled by a spread factor.

__init__(spread_factor: float | Tuple[float, float] = 2.0, *, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None) None[source]

Initialize the TweakSpreadArea functor.

Parameters:
  • spread_factor (Union[float, Tuple[float, float]], optional) –

    How aggressively to spread apart x and/or y coordinates.

    If a tuple is provided, the first element is used for x-coordinate spread and the second for y-coordinate spread. If a single float is provided, it is used for both.

  • xlim (Optional[Tuple[float, float]], optional) – If provided, outer vertices falling within the x-coordinate range will be spread horizontally away from the range’s centroid.

  • ylim (Optional[Tuple[float, float]], optional) – If provided, outer vertices falling within the y-coordinate range will be spread vertically away from the range’s centroid.

Methods

__init__(spread_factor: float | Tuple[float, float] = 2.0, *, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None) None[source]

Initialize the TweakSpreadArea functor.

Parameters:
  • spread_factor (Union[float, Tuple[float, float]], optional) –

    How aggressively to spread apart x and/or y coordinates.

    If a tuple is provided, the first element is used for x-coordinate spread and the second for y-coordinate spread. If a single float is provided, it is used for both.

  • xlim (Optional[Tuple[float, float]], optional) – If provided, outer vertices falling within the x-coordinate range will be spread horizontally away from the range’s centroid.

  • ylim (Optional[Tuple[float, float]], optional) – If provided, outer vertices falling within the y-coordinate range will be spread vertically away from the range’s centroid.

__call__(leader_vertices: Sequence[Tuple[float, float]], ax: Axes | None = None) List[Tuple[float, float]][source]

Spread outer vertex of leader polygon out from specied area.

Parameters:
  • leader_vertices (Sequence[Tuple[float, float]]) – A sequence of tuples representing the (x, y) coordinates of the leader vertices.

  • ax (mpl_axes.Axes) –

    The matplotlib Axes object on which the leader vertices are plotted.

    Not used for this tweak.

Returns:

The modified sequence of leader vertices with the outer vertex position adjusted.

Return type:

List[Tuple[float, float]]