graphinglib.Arrow#

class graphinglib.Arrow(pointA: tuple[float, float], pointB: tuple[float, float], color: str | Inherit = Inherit, width: float | Inherit = Inherit, head_size: float | Inherit = Inherit, shrink: float = 0, style: Literal['->', '-|>', '-[', ']->', 'simple', 'fancy', 'wedge'] | Inherit = Inherit, alpha: float | Inherit = Inherit, two_sided: bool = False)[source]#

This class implements an arrow object.

Parameters:
pointAtuple[float, float]

Point A of the arrow. If the arrow is single-sided, refers to the tail.

pointBtuple[float, float]

Point B of the arrow. If the arrow is single-sided, refers to the head.

colorstr

Color of the arrow. Default depends on the figure_style configuration.

widthfloat, optional

Arrow line width. Typical range is 0.5 to 4. Default depends on the figure_style configuration.

head_sizefloat, optional

Scales the size of the arrow head. Typical range is 0.5 to 3. Default depends on the figure_style configuration.

styleLiteral["->", "-|>", "-[", "]->", "simple", "fancy", "wedge"] | Inherit, optional

The style of the arrow. For a visual explanation of all available styles, see the gallery Arrow Styles example. Values are "->", "-|>", "-[", "]->", "simple", "fancy", and "wedge". Default depends on the figure_style configuration.

Warning

The style parameter differs slightly from matplotlib’s arrowstyle since GraphingLib also uses a two_sided parameter to explicitly define whether the arrow is single or double-sided.

shrinkfloat

Fraction of the total length of the arrow to shrink from both ends. Range is 0 to 0.5. A value of 0.5 means the arrow is no longer visible. Defaults to 0.

alphafloat

Opacity of the arrow. Range is 0 (transparent) to 1 (opaque). Default depends on the figure_style configuration.

two_sidedbool

If True, an arrow is shown at both head and tail. Defaults to False.

Notes

Color parameters accept Matplotlib color formats: named colors ("blue"), short color strings ("b"), hex strings ("#0000ff"), grayscale strings ("0.5"), and RGB/RGBA tuples with values between 0 and 1 ((0, 0, 1) or (0, 0, 1, 0.5)).

Methods

__init__(pointA, pointB[, color, width, ...])

This class implements an arrow object.

copy()

Returns a deep copy of the Arrow object.

copy_with(**kwargs)

Returns a deep copy of the Plottable with specified attributes overridden.