Dear All,
I am using Python 3.4.1 on Debian. Matplotlib works fine for me, but when I
try to save the animation using moviewriter I get error.
My program file:
************************** short test
program**************************************
#!/usr/bin/env python3
from matplotlib import animation as anim
from matplotlib import pyplot as plt
import numpy as np
fig = plt.figure() # the basic canvas
plt.axis([-1,1,-1,1]) # set the x-axis
abcissa, = plt.plot([],[], color='black')
# initialise the x-axis
graph, = plt.plot([], [], color='blue')
# initialise the graph
t, = plt.plot([],[], color='red')
def init():
x = np.arange(-1,1,0.01)# the x-values
y = np.sin(np.pi/2 * x)
abcissa.set_data(x, 0) # draw the x-axis
graph.set_data(x, y) # draw the graph
return abcissa, graph
def animate(i):
p = -1 + i*0.02 # the pt p where the tangent is to be drawn
tx = [p-1,p+1]
ty = [np.sin(np.pi/2 * p) - np.pi/2 * np.cos(np.pi/2 *p),
np.sin(np.pi/2 * p) + np.pi/2 * np.cos(np.pi/2 *p)]
t.set_data(tx, ty)
return t,
ani = anim.FuncAnimation(fig, animate, init_func=init,
frames=100, interval=30, blit=True)
##plt.show()
Writer = anim.writers['ffmpeg']
writer = Writer(fps=15, bitrate=1800)
ani.save('test.mp4', writer=writer)
********************end of
program*************************************************
plt.show() shows correctly; on trying to save as above I get the following
error:
**************error from python
******************************************************
Traceback (most recent call last):
File "/home/partha/নথিপত্র/স্বরচিত/আমারপ্রোগ্রাম/test.py", line 48, in
<module>
ani.save('test.mp4', writer=writer)
File "/usr/lib/python3/dist-packages/matplotlib/animation.py", line 719,
in save
writer.grab_frame(**savefig_kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/animation.py", line 205,
in grab_frame
dpi=self.dpi, **savefig_kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1422, in
savefig
self.canvas.print_figure(*args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line
2225, in print_figure
self.figure.dpi = origDPI
File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 385, in
_set_dpi
self.dpi_scale_trans.clear().scale(dpi, dpi)
File "/usr/lib/python3/dist-packages/matplotlib/transforms.py", line 1786,
in clear
self._mtx = np.identity(3)
File "/usr/lib/python3/dist-packages/numpy/core/numeric.py", line 2053, in
identity
from numpy import eye
File "<frozen importlib._bootstrap>", line 2280, in _handle_fromlist
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0:
invalid start byte
*************end of
error****************************************************
As you can see from the first line of the error, my locale is set to bn_IN
(Bengali, India).
Any help in trying to resolve this problem would be highly appreciated.
With my thanks and regards,
partha
--
View this message in context:
http://matplotlib.1069221.n5.nabble.com/matplotlib-error-on-trying-to-use-moviewriter-tp43916.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users