Repeated plot.plot() fail
Hi there,
Since bugs report get a lot of attention these days :-) let me add another one:
#######################
from yade import plot
plot.addData(x = 1 , y = 5)
plot.plots = {'x':'y'}
plot.plot()
plot.plot()
#######################
gives error messages (pointing to py/plot.py, see [*] below) at the second plot.plot() command.
It seems you can also replace any of the 2 plot.plot() (or both) with eg plot.plot(noShow=True).savefig('test.png') and get the same behavior.
I would prefer having the possibility to ask twice for a plot in one YADE session, what do you think ?
[*] Error message with yadedaily 2018.02b-290bf6a54e~bionic or yade 2018.02b:
####################
AttributeError Traceback (most recent call last)
/usr/bin/yadedaily in <module>()
----> 1 plot.plot()
/usr/lib/x86_64-linux-gnu/yadedaily/py/yade/plot.py in plot(noShow, subPlots)
592 .. note:: For backwards compatibility reasons, *noShow* option will return list of figures for multiple figures but a single figure (rather than list with 1 element) if there is only 1 figure.
593 """
--> 594 createPlots(subPlots=subPlots)
595 global currLineRefs
596 figs=set([l.line.axes.get_figure() for l in currLineRefs])
/usr/lib/x86_64-linux-gnu/yadedaily/py/yade/plot.py in createPlots(subPlots, scatterSize, wider)
370 def createPlots(subPlots=True,scatterSize=60,wider=False):
371 global currLineRefs
--> 372 figs=set([l.line.get_axes().get_figure() for l in currLineRefs]) # get all current figures
373 for f in figs: pylab.close(f) # close those
374 currLineRefs=[] # remove older plots (breaks live updates of windows that are still open)
AttributeError: 'Line2D' object has no attribute 'get_axes'
######################
Original bug report by Jérôme Duriez on 2019-01-29 : https://bugs.launchpad.net/yade/+bug/1813782
Edited by Janek Kozicki