Description
Debian Wheezy
Python 2.7.3
matplotlib 1.1.1rc2
I have a simple plot with a marker which I want to save to PDF/EPS with savefig. When setting the markeredgewidth I get an Error from savefig or rather backend_pdf.py. The same holds for eps export. Here's the traceback (MWE for this behaviour below):
Traceback (most recent call last):
File "mwe.py", line 13, in
fig.savefig('mmo_example_1.pdf',format='pdf')
File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 1185, in savefig
self.canvas.print_figure(_args, *_kwargs)
File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 2021, in print_figure
*_kwargs)
File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 1789, in print_pdf
return pdf.print_pdf(_args, **kwargs)
File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py", line 2191, in print_pdf
file.close()
File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py", line 482, in close
self.writeMarkers()
File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py", line 1212, in writeMarkers
bbox = bbox.padded(lw * 0.5)
TypeError: can't multiply sequence by non-int of type 'float'
# python
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
t = np.arange(-0.9999, 0.0, 0.001)
fig = plt.figure(figsize=(7.,5.))
ax = fig.add_axes([0.13,0.13,0.82,0.82])
ax.plot(t,0.2*np.sin(4*t)+t + np.sign(t)*0.5,'r-o',mfc='white',mec='r',mew='1',markevery=(500,1000)) # produces the following errror when using savefig:
# File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py", line 1212, in writeMarkers
# bbox = bbox.padded(lw * 0.5)
#TypeError: can't multiply sequence by non-int of type 'float'
#ax.plot(t,0.2*np.sin(4*t)+t + np.sign(t)*0.5,'r-o',mfc='white',mec='r',markevery=(500,1000)) # works like a charm
plt.draw()
fig.savefig('mmo_example_1.eps',format='eps')
fig.savefig('mmo_example_1.pdf',format='pdf')
plt.show()