Skip to content

rocheometry.matplotlib

Optional Matplotlib adapters for Rocheometry Bézier paths.

Importing this module requires the plot extra; the core package does not import Matplotlib.

add_binary_lobes

add_binary_lobes(ax: Axes, binary: BinaryGeometry, *, margin: float = 0.05, **kwargs: Any) -> tuple[PathPatch, PathPatch]

Add both critical-lobe sections to axes and frame them with equal aspect.

Uses the same Bézier curves and padded bounds as SVG document(binary). The axes keep their usual upward-positive scientific y direction. Existing artists remain present; the axes limits and aspect are updated.

Parameters:

Name Type Description Default
ax Axes

Existing Matplotlib axes to draw on.

required
binary BinaryGeometry

Binary whose two critical-lobe sections are drawn.

required
margin float

Finite non-negative padding as a fraction of the larger combined lobe dimension (default 0.05).

0.05
**kwargs Any

PathPatch properties applied to both components. Paths default to unfilled outlines; pass fill=True to override.

{}

Returns:

Type Description
tuple[PathPatch, PathPatch]

Two PathPatch objects in component order, both added to ax.

path_patch

path_patch(path: BezierPath | CompoundBezierPath, **kwargs: Any) -> PathPatch

Create a Matplotlib PathPatch for a Rocheometry Bézier path.

The Matplotlib patch counterpart of svg.path_element(); both take a Rocheometry Bézier path and return a native drawing element, and both default to an unfilled outline.

Parameters:

Name Type Description Default
path BezierPath | CompoundBezierPath

Planar Bézier path or compound to convert.

required
**kwargs Any

Patch options forwarded to matplotlib.patches.PathPatch, such as edge colour, line width, or fill=True with a face colour.

{}