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
707 stars 37 forks source link

Misc `not found`, `not in list` errors #52

Closed tfiers closed 1 year ago

tfiers commented 1 year ago

Hi, this project is a great idea.

I get errors when trying to add text to an axis:

Traceback (most recent call last):
  File "C:\conda\lib\site-packages\pylustrator\components\qitem_properties.py", line 1019, in buttonAddTextClicked
    getReference(self.element), getReference(text)), text, ".new")
  File "C:\conda\lib\site-packages\pylustrator\change_tracker.py", line 162, in getReference
    raise TypeError(str(type(element)) + " not found")
TypeError: <class 'matplotlib.text.Text'> not found

or add an arrow:

Traceback (most recent call last):
  File "C:\conda\lib\site-packages\pylustrator\components\qitem_properties.py", line 1085, in buttonAddArrowClicked
    p._posA_posB[0], p._posA_posB[1], getReference(p)),
  File "C:\conda\lib\site-packages\pylustrator\change_tracker.py", line 104, in getReference
    index = element.axes.patches.index(element)
ValueError: <matplotlib.patches.FancyArrowPatch object at 0x0000017A2D76B820> is not in list

or change a Line2D's property:

<matplotlib.lines.Line2D object at 0x000001F3198B2160> is not in list

The edits are displayed in the plot, but are not saved to the .py file.

pylustrator version 1.2.1 matplotlib version 3.5.1

rgerum commented 1 year ago

its a problem with the exception_silencer and the recent matplotlib version. You can turn it of with:

pylustrator.start(use_exception_silencer=False)

with I will make the default in the next release

tfiers commented 1 year ago

That fixes it indeed, thanks!