Parameter nicht gefunden, obwohl er in Funktionsaufruf vorhanden ist (nicht die Syntax verstehen) in PythonPython

Python-Programme
Anonymous
 Parameter nicht gefunden, obwohl er in Funktionsaufruf vorhanden ist (nicht die Syntax verstehen) in Python

Post by Anonymous »

Dieser Code kompiliert nicht, er gibt eine Fehlermeldung.

Code: Select all

fig, ax = plt.subplots()
posX = 0
posY = 0
scat = ax.scatter(pos, 0, c="b", s=5, label=f'der sich bewegende punkt')
ax.set(xlim=[-5, 5], ylim=[-1, 1], xlabel='Ort', ylabel='garnix is 1D')
ax.legend()

def update(frame, posX, posY):
# for each frame, update the data stored on each artist.
x = posX + random.gauss()
y = posY + random.gauss()
posX = posX + random.gauss()
posY = posY + random.gauss()
# update the scatter plot:
scat.set_offsets([x,y])
return (x,y)

ani = animation.FuncAnimation(fig=fig, func=update(posX, posY), frames=240, interval=50)
ani.save('test.mp4')
< /code>
Ich habe erwartet, dass es gut läuft. Genau wie der Code unten < /p>
fig, ax = plt.subplots()
pos = 0
scat = ax.scatter(pos, 0, c="b", s=5, label=f'der sich bewegende punkt')
ax.set(xlim=[-5, 5], ylim=[-1, 1], xlabel='Ort', ylabel='garnix is 1D')
ax.legend()

def update(frame):
# for each frame, update the data stored on each artist.
x = pos + random.gauss()`
# update the scatter plot:
scat.set_offsets([x,0])
return (x)

ani = animation.FuncAnimation(fig=fig, func=update, frames=40, interval=30)
ani.save('test.mp4')

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post