Reputation: 263
I'm trying to save a figure in the eps format using the following code:
plt.savefig("test.eps", format="eps")
but I get the error:
File "C:\Python27\lib\site-packages\matplotlib\backends\backend_ps.py", line 258, in set_linewidth
self._pswriter.write("%1.3f setlinewidth\n"%linewidth)
TypeError: float argument required, not str
How do I fix this? I have Matplotlib 1.3.1
Upvotes: 3
Views: 7073
Reputation: 263
I figured out the issue just now. It seems that when you save figures as eps, you need to make sure that all figure properties are floats. I had a command 'linewidth = 1'. It needs to be 'linewidth=1.0'. Then it works. Strange that other formats such as svg work without issues.
Thanks!
Emmanuel
Upvotes: 7