Issue
In a recent question of mine, I quote some code by Jake Vanderplas. One can find the following code:
from matplotlib import pyplot as plt
from matplotlib import animation
fig = plt.figure()
ax = plt.axes(xlim=(0, 2), ylim=(0, 100))
line, = plt.plot([], [])
def init():
line.set_data([], [])
return line,
def animate(i):
line.set_data([0, 2], [0,i])
return line,
anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=100, interval=20, blit=True)
plt.show()
In the init
or animate
function, the return "value" is line,
(with a comma).
Question: Is there a difference with a return "value" that would be line
(whitout comma)?
Thanks
Solution
line,
is a tuple with one object in it.
line
is just the line object.
In [80]: line = object()
In [81]: line,
Out[81]: (<object at 0x9ee7fa8>,)
Answered By - unutbu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.