Not able to write eps file ...

Hi all,

I guess I am doing something silly, but it is not obvious. Guess one of you can help!!

I am using NumPy 1.3.0 and matplotlib 0.98.5.2

I am using the following to plot,

plt.rc(‘lines’, linewidth=1.5)

sym = cycle([{‘c’:‘b’, ‘ls’:’-’, ‘marker’:‘o’, ‘mfc’:‘b’, ‘mec’:‘b’, ‘mew’:‘1.0’},

          {'c':'b', 'ls':'-', 'marker':'o', 'mfc':'w', 'mec':'b', 'mew':'1.0'},

          {'c':'g', 'ls':'-', 'marker':'s', 'mfc':'g', 'mec':'g', 'mew':'1.0'},

          {'c':'g', 'ls':'-', 'marker':'s', 'mfc':'w', 'mec':'g', 'mew':'1.0'}])


ax.plot(range(len(eles)), y, **sym.next())

plt.savefig(‘fig.eps’)
plt.show()

The above fails even when I explicitly set lw in sym with the following,

Traceback (most recent call last):
File “plot.py”, line 67, in

plt.savefig('dM_single.eps')

File “/usr/lib/python2.5/site-packages/matplotlib/pyplot.py”, line 345, in savefig

return fig.savefig(*args, **kwargs)

File “/usr/lib/python2.5/site-packages/matplotlib/figure.py”, line 990, in savefig

self.canvas.print_figure(*args, **kwargs)

File “/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py”, line 1419, in print_figure

**kwargs)

File “/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py”, line 1308, in print_eps

return ps.print_eps(*args, **kwargs)

File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”, line 869, in print_eps

return self._print_ps(outfile, 'eps', *args, **kwargs)

File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”, line 895, in _print_ps

orientation, isLandscape, papertype)

File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”, line 969, in _print_figure

self.figure.draw(renderer)

File “/usr/lib/python2.5/site-packages/matplotlib/figure.py”, line 772, in draw

for a in self.axes: a.draw(renderer)

File “/usr/lib/python2.5/site-packages/matplotlib/axes.py”, line 1601, in draw

a.draw(renderer)

File “/usr/lib/python2.5/site-packages/matplotlib/lines.py”, line 476, in draw

markerFunc(renderer, gc, tpath, affine.frozen())

File “/usr/lib/python2.5/site-packages/matplotlib/lines.py”, line 872, in _draw_circle

rgbFace)

File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”, line 529, in draw_markers

self._draw_ps(ps, gc, rgbFace, fill=False, stroke=False)

File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”, line 794, in _draw_ps

self.set_linewidth(gc.get_linewidth())

File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”, line 198, in set_linewidth

self._pswriter.write("%1.3f setlinewidth\n"%linewidth)

TypeError: float argument required

Can someone tell me what I am doing wrong?

Regards,
Chaitanya

Try to replace '1.0' with 1.0 for mew.
Regards,

-JJ

···

On Mon, May 18, 2009 at 11:47 AM, Chaitanya Krishna <icymist@...287...> wrote:

Hi all,

I guess I am doing something silly, but it is not obvious. Guess one of you
can help!!

I am using NumPy 1.3.0 and matplotlib 0.98.5.2

I am using the following to plot,

...
plt.rc('lines', linewidth=1.5)
...
sym = cycle([{'c':'b', 'ls':'-', 'marker':'o', 'mfc':'b', 'mec':'b',
'mew':'1.0'},
{'c':'b', 'ls':'-', 'marker':'o', 'mfc':'w', 'mec':'b',
'mew':'1.0'},
{'c':'g', 'ls':'-', 'marker':'s', 'mfc':'g', 'mec':'g',
'mew':'1.0'},
{'c':'g', 'ls':'-', 'marker':'s', 'mfc':'w', 'mec':'g',
'mew':'1.0'}])
...
ax.plot(range(len(eles)), y, **sym.next())
plt.savefig('fig.eps')
plt.show()

The above fails even when I explicitly set lw in sym with the following,

Traceback (most recent call last):
File "plot.py", line 67, in <module>
plt.savefig('dM_single.eps')
File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 345, in
savefig
return fig.savefig(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 990, in
savefig
self.canvas.print_figure(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
1419, in print_figure
**kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
1308, in print_eps
return ps.print_eps(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 869, in print_eps
return self._print_ps(outfile, 'eps', *args, **kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 895, in _print_ps
orientation, isLandscape, papertype)
File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 969, in _print_figure
self.figure.draw(renderer)
File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 772, in
draw
for a in self.axes: a.draw(renderer)
File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 1601, in
draw
a.draw(renderer)
File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line 476, in
draw
markerFunc(renderer, gc, tpath, affine.frozen())
File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line 872, in
_draw_circle
rgbFace)
File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 529, in draw_markers
self._draw_ps(ps, gc, rgbFace, fill=False, stroke=False)
File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 794, in _draw_ps
self.set_linewidth(gc.get_linewidth())
File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 198, in set_linewidth
self._pswriter.write("%1.3f setlinewidth\n"%linewidth)
TypeError: float argument required

Can someone tell me what I am doing wrong?

Regards,
Chaitanya

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options