rocheometry.svg¶
SVG serialization for Roche geometry paths.
document ¶
document(binary: BinaryGeometry, *, margin: float = 0.05, linewidth: float = 1.0, precision: int = 12, y_axis: Literal['down', 'up'] = 'down') -> str
Return a standalone SVG with both critical-lobe orbital sections.
The binary's scientific frame and separation are retained. By default, SVG's downward-positive display y-axis is not hidden by a transform. Choose y_axis="up" to display positive scientific y upwards, as Matplotlib does; this flips the SVG display, not the path coordinates.
Stroke width is independent of the drawing's scale. Bounds do not include the stroke; with margin=0, half the stroke can be clipped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
binary
|
BinaryGeometry
|
Binary whose two critical-lobe sections define the drawing. |
required |
margin
|
float
|
Padding as a fraction of the larger lobe-bound dimension. Must be finite and non-negative. |
0.05
|
linewidth
|
float
|
Stroke width in screen pixels. Must be finite and non-negative. |
1.0
|
precision
|
int
|
Significant digits per coordinate, from 1 to 17. |
12
|
y_axis
|
Literal['down', 'up']
|
Display positive y down (default) or up. |
'down'
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
The computed drawing bounds have zero size. |
document_paths ¶
document_paths(paths: Iterable[BezierPath | CompoundBezierPath], *, margin: float = 0.05, linewidth: float = 1.0, precision: int = 12, classes: Iterable[str | None] | None = None, y_axis: Literal['down', 'up'] = 'down') -> str
Render any ordered sequence of Bézier paths in a standalone SVG.
All paths share the default unfilled currentColor outline styling;
optional CSS classes allow callers to style them independently. Empty
compound paths are permitted but do not contribute to the bounds. At
least one nonempty path is needed to define a viewBox.
The default downward-positive display orientation preserves the raw path coordinates. y_axis="up" flips display y using SVG transforms, so the resulting view has the same orientation as Matplotlib.
Stroke width is independent of the drawing's scale. Bounds do not include the stroke; with margin=0, half the stroke can be clipped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paths
|
Iterable[BezierPath | CompoundBezierPath]
|
Paths to draw, in stacking order (first at the back). |
required |
margin
|
float
|
Padding as a fraction of the larger combined dimension. |
0.05
|
linewidth
|
float
|
Stroke width in screen pixels. Must be finite and non-negative. |
1.0
|
precision
|
int
|
Significant digits per coordinate, from 1 to 17. |
12
|
classes
|
Iterable[str | None] | None
|
Optional CSS class per path, or None for no classes. |
None
|
y_axis
|
Literal['down', 'up']
|
Display positive scientific y down (default) or up. |
'down'
|
path_element ¶
path_element(path: BezierPath | CompoundBezierPath, *, precision: int = 12, class_name: str | None = None, fill: str = 'none', stroke: str = 'currentColor', linewidth: float | None = None, transform: str | None = None, _non_scaling_stroke: bool = False) -> str
Return a styled SVG path element for a Rocheometry Bézier path.
The SVG element counterpart of matplotlib.path_patch(); both take a Rocheometry Bézier path and return a native drawing element.
The default is an unfilled currentColor outline, matching document().
Attribute values are XML-escaped. A transform, when supplied, is emitted
as an SVG attribute; the underlying cubic coordinates remain unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
BezierPath | CompoundBezierPath
|
Bézier path or compound to serialize. |
required |
precision
|
int
|
Significant digits per coordinate, from 1 to 17. |
12
|
class_name
|
str | None
|
Optional CSS class. |
None
|
fill
|
str
|
SVG fill value, default "none". |
'none'
|
stroke
|
str
|
SVG stroke value, default "currentColor". |
'currentColor'
|
linewidth
|
float | None
|
Optional non-negative stroke width in SVG coordinate units. |
None
|
transform
|
str | None
|
Optional SVG transform attribute. |
None
|