ase_notebook.backend.svg module¶
A module for creating an SVG visualisation of a structure.
-
ase_notebook.backend.svg.
concatenate_svgs
(svgs, max_columns=None, scale=None, label=False, size=12, weight='bold', inset=(0.1, 0.1))[source]¶ Create a grid of SVGs, with a maximum number of columns.
- Parameters
svgs (list) – Items may be raw SVG strings, or any objects with a
tostring
orto_str
method.max_columns (int or None) – max number of columns, or if None, only use one row
label (bool) – whether to add a label for each SVG (cycle through upper case letters)
size (int) – label font size
weight (str) – label font weight
inset (tuple) – inset the label by x times the SVG width and y times the SVG height
- Returns
- Return type
svgutils.compose.Figure
-
ase_notebook.backend.svg.
create_arc_element
(center, start, end, radius, **kwargs)[source]¶ Create an arc (circle section) path element.
- Parameters
- Returns
- Return type
-
ase_notebook.backend.svg.
create_axes_elements
(axes, window_size, *, length=15, font_size=14, inset=(20, 20), font_offset=1.0, line_width=1, line_color='black', labels=('X', 'Y', 'Z'), colors=('red', 'green', 'blue'))[source]¶ Create the SVG elements, related to the axes.
-
ase_notebook.backend.svg.
create_svg_document
(elements, size, viewbox=None, background_color='white', background_opacity=1.0)[source]¶ Create the full SVG document.
- Parameters
viewbox – (minx, miny, width, height)
-
ase_notebook.backend.svg.
create_svg_document_with_light
(elements, size, viewbox=None, background_color='white', background_opacity=1.0)[source]¶ Create the full SVG document, with a lighting filter.
Resources:
https://www.w3.org/TR/SVG11/filters.html#LightSourceDefinitions
https://svgwrite.readthedocs.io/en/master/classes/filters.html
- Parameters
viewbox – (minx, miny, width, height)
-
ase_notebook.backend.svg.
generate_svg_elements
(element_group, element_colors=None, background_color='white')[source]¶ Create the SVG elements, related to the 3D objects.
- Parameters
element_group (ase_notebook.draw_elements.DrawGroup) – Container of all element groups to be created.
background_color (str) –
- Returns
- Return type
-
ase_notebook.backend.svg.
get_svg_string
(svg)[source]¶ Return the raw string of an SVG object with a
tostring
orto_str
method.
-
ase_notebook.backend.svg.
string_to_compose
(string)[source]¶ Convert an SVG string to a
svgutils.compose.SVG
.