matplotlib의 애니메이션 모듈을 사용하여 실시간 스 캐터 - 종류 플롯을 만들려고 노력하고 있습니다. 그러나 나는 그걸 상당히 신참입니다. 내 목표는 내가 음모를 꾸미고 싶은 데이터를 수신 할 때마다 음모를 업데이트하여 데이터가 수신 될 때마다 이전의 점이 사라지고 새로운 점이 그려지도록하는 것입니다.애니메이션으로 스 캐터 업데이트
나는 무한 루프 및 데이터의 임의의 세대 수신 데이터로 대체하면 내 프로그램은 다음과 같이 쓸 수있다 :
> Traceback (most recent call last):
File "./skyplot.py", line 138, in <module>
ani= animation.FuncAnimation(fig, sat_plot.update, azimuths, elevations, colors)
File "/usr/lib/pymodules/python2.7/matplotlib/animation.py", line 442, in __init__
TimedAnimation.__init__(self, fig, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/animation.py", line 304, in __init__
Animation.__init__(self, fig, event_source=event_source, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/animation.py", line 53, in __init__
self._init_draw()
File "/usr/lib/pymodules/python2.7/matplotlib/animation.py", line 469, in _init_draw
self._drawn_artists = self._init_func()
TypeError: 'list' object is not callable
: 지금
fig = plt.figure()
skyplot = fig.add_subplot(111, projection='polar')
skyplot.set_ylim(90) # sets radius of the circle to maximum elevation
skyplot.set_theta_zero_location("N") # sets 0(deg) to North
skyplot.set_theta_direction(-1) # sets plot clockwise
skyplot.set_yticks(range(0, 90, 30)) # sets 3 concentric circles
skyplot.set_yticklabels(map(str, range(90, 0, -30))) # reverse labels
plt.ion()
while(1):
azimuths = random.sample(range(360), 8)
elevations = random.sample(range(90), 8)
colors = numpy.random.rand(3,1)
sat_plot = satellite()
ani= animation.FuncAnimation(fig, sat_plot.update, azimuths, elevations, colors)
class satellite:
def __init__(self):
self.azimuths = []
self.elevations = []
self.colors = []
self.scatter = plt.scatter(self.azimuths, self.elevations, self.colors)
def update(self, azimuth, elevation, colors):
self.azimuths = azimuth
self.elevations = elevation
return self.scatter
, 나는 다음과 같은 오류를 받고 있어요을
누구나 내가 뭘 잘못하고 있는지 어떻게 알 수 있습니까? 어떻게해야합니까?
미리 감사드립니다.
'FuncAnimation'을 (를) 사용하고 있는지 확실하지 않습니다. 'FuncAnimation (fig, sat_plot.update, fargs = (방위각, 고도, 색))'과 같이 호출해서는 안됩니다. –