← Back to team overview

yade-users team mailing list archive

[Question #707019]: plot.plot() issue...unexpected keyword argument 'verts'

 

New question #707019 on Yade:
https://answers.launchpad.net/yade/+question/707019

Hello,

I'm running Ubuntu 20.04.  I seem to be running into a similar plotting error as documented in this previous thread: 
https://answers.launchpad.net/yade/+question/703685

I have tried the suggestions from the thread of uninstalling and reinstalling matplotlib version 3.1.2, as well as trying on yadedaily. Both seem to produce different errors.

Can anyone help with suggestions for fixing this issue?  Example code and output below. Cheers,

Kevin



The example code/script I am running:
```
from yade import pack, plot

O.bodies.append(geom.facetBox((.5, .5, .5), (.5, .5, .5), wallMask=31))
sp = pack.SpherePack()
sp.makeCloud((0, 0, 0), (1, 1, 1), rMean=.05, rRelFuzz=.5)
sp.toSimulation()

O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
                [Ip2_FrictMat_FrictMat_FrictPhys()],
                [Law2_ScGeom_FrictPhys_CundallStrack()]
        ),
        NewtonIntegrator(gravity=(0, 0, -9.81), damping=0.4),
        PyRunner(command='checkUnbalanced()', realPeriod=2),
        PyRunner(command='addPlotData()', iterPeriod=100)
]
O.dt = .5 * PWaveTimeStep()
O.trackEnergy = True

def checkUnbalanced():
	if unbalancedForce() < .05:
		O.pause()
		plot.saveDataTxt('bbb.txt.bz2')

def addPlotData():
	plot.addData(i=O.iter, unbalanced=unbalancedForce(), **O.energy)

kinetic_energy = sum([0.5*b.state.mass*b.state.vel.norm()**2 for b in O.bodies])
avg_mass = numpy.average([b.state.mass for b in O.bodies])
max_coord_all_particles = 0
for b in O.bodies:
	coord = len(b.intrs()) 
	if coord > max_coord_all_particles:
		max_coord_all_particles = coord

max_interactions_body1 = len(O.bodies[1].intrs())
plot.plots = {'i': ('unbalanced', None, O.energy.keys)}
plot.plot()
O.saveTmp()
```

The output when I run with yade:
```
$ yade gravitydep.py
Welcome to Yade 2020.01a 
Using python version: 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0]
TCP python prompt on localhost:9000, auth cookie `scdyka'
XMLRPC info provider on http://localhost:21000
Running script gravitydep.py
Traceback (most recent call last):
  File "/usr/bin/yade", line 336, in runScript
    execfile(script,globals())
  File "/usr/lib/python3/dist-packages/past/builtins/misc.py", line 87, in execfile
    exec_(code, myglobals, mylocals)
  File "gravitydep.py", line 79, in <module>
    plot.plot()
  File "/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py", line 600, in plot
    createPlots(subPlots=subPlots)
  File "/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py", line 462, in createPlots
    createLines(pStrip,plots_p_y1,isY1=True,y2Exists=len(plots_p_y2)>0)
  File "/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py", line 444, in createLines
    scatter=pylab.scatter(scatterPt[0] if not math.isnan(scatterPt[0]) else 0,scatterPt[1] if not math.isnan(scatterPt[1]) else 0,s=scatterSize,color=line.get_color(),**scatterMarkerKw)
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/pyplot.py", line 2790, in scatter
    __ret = gca().scatter(
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/__init__.py", line 1423, in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/axes/_axes.py", line 4634, in scatter
    collection._internal_update(kwargs)
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/artist.py", line 1186, in _internal_update
    return self._update_props(
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/artist.py", line 1160, in _update_props
    raise AttributeError(
AttributeError: PathCollection.set() got an unexpected keyword argument 'verts'
[[ ^L clears screen, ^U kills line. F12 controller, F11 3D view (press "h" in 3D view for help), F10 both, F9 generator, F8 plot. ]]


Output with yadedaily:
```
$ yadedaily gravitydep.py
Welcome to Yade 20230525-7264~94b01fd~focal1 
Using python version: 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0]
TCP python prompt on localhost:9000, auth cookie `ekusyc'
XMLRPC info provider on http://localhost:21000
Running script gravitydep.py
yade.plot: creating fake plot, since there are no y-data yet
WARNING:matplotlib.legend:No artists with labels found to put in legend.  Note that artists whose label start with an underscore are ignored when legend() is called with no argument.
[[ ^L clears screen, ^U kills line. F12 controller, F11 3D view (press "h" in 3D view for help), F10 both, F9 generator, F8 plot. ]]

Segmentation fault (core dumped)
```

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.