मैं एनिमेटेड हीटमैप बनाने के लिए matplotlib का उपयोग कर रहा हूं। मेरे पास एक टेक्स्ट फ़ाइल (rs_h) में डेटा है जिसमें 3 कॉलम हैं - एक्स, वाई, जेड; मैं scatterplot उपयोग कर रहा हूँ एक सरल हीटमैप बनाने के लिए, और फिर समयपरेशानी बचत matplotlib एनीमेशन
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation
data = pd.read_table('rs_h', header=None, sep=r"\s*")
frames = np.array_split(data, 9)
def main():
numframes = 9
numpoints = 75
x, y, c = np.random.random((3, numpoints))
fig = plt.figure()
scat = plt.scatter(x, y, c=c)#, s=100)
ani = animation.FuncAnimation(fig, update_plot, frames=xrange(numframes),
interval = 5)
#ani.save("movie.avi", codec='avi')
plt.show()
def update_plot(i):
frame = frames[i]
scat = plt.scatter(frame[0], frame[1], c=frame[2])
return scat,
main()
मैं कोई परेशानी नहीं एनिमेटेड हीटमैप हो रही हो रही है से अधिक हीटमैप अद्यतन करने के लिए एनीमेशन पैकेज का उपयोग; हालांकि, मैं एक मुद्दा में चलाने जब मैं और बचाने के लिए एनीमेशन
/Users/Arjun/anaconda/lib/python2.7/site-packages/matplotlib/animation.py:695: UserWarning: MovieWriter ffmpeg unavailable
warnings.warn("MovieWriter %s unavailable" % writer)
Traceback (most recent call last):
File "heat_ani.py", line 29, in <module>
main()
File "heat_ani.py", line 21, in main
ani.save("movie.avi", codec='avi')
File "/Users/Arjun/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 712, in save
with writer.saving(self._fig, filename, dpi):
AttributeError: 'str' object has no attribute 'saving'
किसी को भी पता है कि समस्या क्या है की कोशिश है कि यह कैसे चारों ओर पाने के लिए?
संपादित करें: मुद्दा यह था कि मेरे पास ffmpeg स्थापित नहीं था। एक साधारण काढ़ा कोड काम करने के लिए