Svg
subsurfaceio.logplot.render.svg
Small SVG fragment helpers for logplot rendering.
Functions:
| Name | Description |
|---|---|
escape_attr |
Escape a value for use inside a double-quoted SVG attribute. |
escape_text |
Escape text for safe inclusion in SVG/XML content. |
hline |
Return a horizontal |
tspan |
Return a |
vline |
Return a vertical |
Attributes:
| Name | Type | Description |
|---|---|---|
SvgValue |
TypeAlias
|
|
escape_attr
Escape a value for use inside a double-quoted SVG attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
SvgValue
|
Attribute value; |
required |
Returns:
| Type | Description |
|---|---|
str
|
XML-escaped attribute text. |
escape_text
Escape text for safe inclusion in SVG/XML content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
SvgValue
|
Text or numeric value; |
required |
Returns:
| Type | Description |
|---|---|
str
|
XML-escaped text. |
hline
Return a horizontal <line> SVG element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
float
|
Vertical position in pixels. |
required |
x1
|
float | str
|
Left x, numeric or CSS length. |
0
|
x2
|
float | str
|
Right x, numeric or CSS length. |
'100%'
|
stroke
|
str
|
Stroke color. |
'#000'
|
Returns:
| Type | Description |
|---|---|
str
|
SVG |
tspan
Return a <tspan> with escaped text content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Unescaped text. |
required |
x
|
float | str
|
Horizontal position. |
required |
dy_pt
|
float
|
Vertical offset in points. |
0.0
|
y
|
float | str | None
|
Optional absolute y. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
SVG |
vline
vline(
x: float,
*,
y1: float | str = 0,
y2: float | str = "100%",
stroke: str = "#000",
class_name: str | None = None
) -> str
Return a vertical <line> SVG element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Horizontal position in pixels. |
required |
y1
|
float | str
|
Top y, numeric or CSS length. |
0
|
y2
|
float | str
|
Bottom y, numeric or CSS length. |
'100%'
|
stroke
|
str
|
Stroke color. |
'#000'
|
class_name
|
str | None
|
Optional CSS class. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
SVG |