Skip to content

Template with several other elements #61

@OpenFoam-User

Description

@OpenFoam-User

Hello,
is it possible to use a template that has other elements like text, arrows? Something like this:
image

When I try that template:

import figurefirst as fifi
import matplotlib.pyplot as plt
import numpy as np

layout = fifi.FigureLayout('template.svg')
layout.make_mplfigures()

x = np.linspace(0, 2*np.pi, 200)
y1 = np.sin(x)
y2 = np.cos(x)
y3 = np.sinc(x)

axes = layout.axes

axes['mainaxis'].plot(x, y1)
axes['secondaxis'].plot(x, y2)
axes['thirddaxis'].plot(x, y3)

layout.insert_figures()
layout.write_svg('out.svg')

I get the following error:

Traceback (most recent call last):
  File "test.py", line 5, in <module>
    layout = fifi.FigureLayout('template.svg')
  File "/home/significantcell2/.local/lib/python3.8/site-packages/figurefirst/svg_to_axes.py", line 732, in __init__
    figuretree,grouptree,leafs,svgitemtree = self.make_group_tree()
  File "/home/significantcell2/.local/lib/python3.8/site-packages/figurefirst/svg_to_axes.py", line 867, in make_group_tree
    traverse_svgitems(self.layout,svgitemtree)
  File "/home/significantcell2/.local/lib/python3.8/site-packages/figurefirst/svg_to_axes.py", line 860, in traverse_svgitems
    traverse_svgitems(child,tree_loc)
  File "/home/significantcell2/.local/lib/python3.8/site-packages/figurefirst/svg_to_axes.py", line 860, in traverse_svgitems
    traverse_svgitems(child,tree_loc)
  File "/home/significantcell2/.local/lib/python3.8/site-packages/figurefirst/svg_to_axes.py", line 856, in traverse_svgitems
    item = FFSVGItem(child)
  File "/home/significantcell2/.local/lib/python3.8/site-packages/figurefirst/svg_to_axes.py", line 256, in __init__
    x = float(self.node.getAttribute('x'))
ValueError: could not convert string to float: ''

I 've attached template.svg here:
template.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions