rgerum / pylustrator

Visualisations of data are at the core of every publication of scientific research results. They have to be as clear as possible to facilitate the communication of research. As data can have different formats and shapes, the visualisations often have to be adapted to reflect the data as well as possible. We developed Pylustrator, an interface to directly edit python generated matplotlib graphs to finalize them for publication. Therefore, subplots can be resized and dragged around by the mouse, text and annotations can be added. The changes can be saved to the initial plot file as python code.
GNU General Public License v3.0
706 stars 38 forks source link

plt_draw_text can raise AttributeError on SVG Text nodes #23

Open szmoore opened 4 years ago

szmoore commented 4 years ago

Calling load on a SVG file with <text ...> nodes

  File "/usr/local/lib/python3.7/dist-packages/pylustrator/parse_svg.py", line 643, in parseGroup
    patch_list.append(plt_draw_text(child, trans, style, ids, no_draw=no_draw))
  File "/usr/local/lib/python3.7/dist-packages/pylustrator/parse_svg.py", line 330, in plt_draw_text
    text_content += child.firstChild.nodeValue
AttributeError: 'NoneType' object has no attribute 'nodeValue'

This PR would fix it but I'm not sure if it would break the original use case, which might have been parsing a very different file. https://github.com/szmoore/pylustrator/pull/1

rgerum commented 4 years ago

Unfortunately you opened the pull request on your fork and not on the original repository, so I cannot merge it. Could you please try to make the pullrequest on the main repository and not on your fork? Then I would like to merge it.