splinepy.io.svg.export#

splinepy.io.svg.export(fname, *objects_to_plot, indent=True, box_margins=0.1, tolerance=None, **kwargs)[source]#

Exports a number of splines into an svg plot

Graphics are built to resemble vedo plots as close as possible by relying on spline show_options

Example

spline = c.splinepy.Bezier(
    degrees=[2, 2],
    control_points=[
        [1, 0],
        [3, 1],
        [5, 0],  # First row
        [0, 2],
        [2, 3],
        [4, 2],  # Second row
        [1, 4],
        [3, 5],
        [5, 4],  # Third row
    ],
)
spline.show_options["c"] = (157, 157, 156)
spline.show_options["knot_c"] = "red"
spline.show_options["control_mesh"] = True
spline.show_options["control_mesh_lw"] = 0.05
spline.show_options["control_point_c"] = (0, 102, 157)
spline.show_options["control_mesh_c"] = (0, 102, 157)
spline.show_options["control_point_ids"] = False
spline.show_options["control_point_r"] = 0.2
splinepy.io.svg.export(
    "spline.svg",
    spline,
    box_margins=0.2,
    background=None,
)

results in

Parameters:
  • fname (string) – name of the output file

  • splines (Spline-Type, list, Gustaf-type) – Splines to be exported

  • indent (bool) – Appends white spaces using xml.etree.ElementTree.indent, if possible. Makes it more human-readable

  • box_margins (int, float) – Offset around the splines (relative units)

  • tolerance (float) – Splines that can not be represented exactly by cubic B-Splines (i.e., rationals or high order splines) a tolerance is required for the approximation. Default uses an absolute deviation of 1% of the bounding box of the given spline

  • kwargs

    Specify more output options:

    • background (color, string, rgb, None) : background color

    • linecap (“string”): linecap option for end of lines and connections, see https://www.w3.org/TR/SVG2/ for more information

    • font_family (string): Font for control point ids (optional)

    • font_size (float): Size of control point ids

    • text_anchor (string): position of the control point ids relative to point

    • text_color (color, string, rgb) : control point id color

    • arrow_data_tolerance : (float) Cutt off for arrows that are too small

    • arrow_width (float): Arrow options see https://matplotlib.org/stable/_images/quiver_sizes.svg

    • arrow_head_width (float) : Arrow options see https://matplotlib.org/stable/_images/quiver_sizes.svg

    • arrow_head_length (float) : Arrow options see https://matplotlib.org/stable/_images/quiver_sizes.svg

    • arrow_headaxis_length (float) : Arrow options see https://matplotlib.org/stable/_images/quiver_sizes.svg

    • scalarbar : (bool) Print colorbar below figure

    • n_ticks : (int) Number of Tick mars

    • vmin : (float) Minimum Value - Required for colorbar

    • vmax : (float) Maximum Value - Required for colorbar

    • cmap : (color map string) Defaults to “jet”

    • scalarbar_width : (float) Width of the colorbar relative to picture

    • scalarbar_aspect_ratio : (float) Aspect ratio of colorbar

    • scalarbar_offset : (float) reserved space below picture

    • scalarbar_stroke_width : (float) boundary width

    • scalarbar_tick_distance: (float)distance from tick marks to colorbar

    • scalarbar_font_size : (float)

Return type:

None