python - AttributeError: 'FigureCanvasMac' object has no attribute 'restore_region' with matplotlib animation example on Mac OSX -
using example code matplotlib site:
i error:
attributeerror: 'figurecanvasmac' object has no attribute 'restore_region' spammed in output animation loops. animation doens't display, , shows:
this code works fine on windows pc, , other post find on this recommends set:
blit=false to fix. still same error, not sure whether knows how can fix this. code i'm running is:
import numpy np import matplotlib.pyplot plt import matplotlib.animation animation def update_line(num, data, line): line.set_data(data[...,:num]) return line, fig1 = plt.figure() data = np.random.rand(2, 25) l, = plt.plot([], [], 'r-') plt.xlim(0, 1) plt.ylim(0, 1) plt.xlabel('x') plt.title('test') line_ani = animation.funcanimation(fig1, update_line, 25, fargs=(data, l), interval=50, blit=true) #line_ani.save('lines.mp4') fig2 = plt.figure() x = np.arange(-9, 10) y = np.arange(-9, 10).reshape(-1, 1) base = np.hypot(x, y) ims = [] add in np.arange(15): ims.append((plt.pcolor(x, y, base + add, norm=plt.normalize(0, 30)),)) im_ani = animation.artistanimation(fig2, ims, interval=50, repeat_delay=3000, blit=true) #im_ani.save('im.mp4', metadata={'artist':'guido'}) plt.show() thanks
must set blit=false in both funcanimation() , artistanimation() , code seems work fine. using python 3.4 , py34-matplotlib 1.5.2 macports.
Comments
Post a Comment