(no subject)

Hi,

I am new to matplotlib.

I am trying to save a sample graph I created as a jpeg image. It seems form the documentation that the type of image can be determined by the extension that is used. Commands seem simple enough.

ind = arange(len(importance_IncNodePurity))

the x locations for the groups

width =

0.35 # the width of the bars
p1 = bar(ind, importance_IncNodePurity, width, color=

‘r’)
ylabel(

‘Importance’)
title(

‘Importance Node Purity’)
xticks(ind+width, importance_row_names)

psave=

“c:\eclipse\dafaf.jpg”
savefig(psave)

show()

However, I seem to get the following errors and I have no idea what they mean.

Traceback (most recent call last):

File “C:\Documents and Settings\dmontgomery\workspace\Test\src\create_table.py”, line 259, in
savefig(psave)

File “C:\Python25\Lib\site-packages\matplotlib\pylab.py”, line 796, in savefig
return fig.savefig(*args, **kwargs)

File “C:\Python25\Lib\site-packages\matplotlib\figure.py”, line 759, in savefig
self.canvas.print_figure(*args, **kwargs)

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_tkagg.py”, line 188, in print_figure
**kwargs)

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 493, in print_figure
raise IOError(‘Do not know know to handle extension *%s’ % ext)

IOError: Do not know know to handle extension *.jpg

Thanks,

David

I am trying to save a sample graph I created as a jpeg image. It seems
form the documentation that the type of image can be determined by the
extension that is used. Commands seem simple enough.

ind = arange(len(importance_IncNodePurity)) # the x locations for the
groups width = 0.35 # the width of the bars
p1 = bar(ind, importance_IncNodePurity, width, color='r')
ylabel('Importance')
title('Importance Node Purity')
xticks(ind+width, importance_row_names)
psave="c:\eclipse\dafaf.jpg"
savefig(psave)
show()

However, I seem to get the following errors and I have no idea what they
mean.

[...]

File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
line 493, in print_figure raise IOError('Do not know know to handle
extension *%s' % ext)
IOError: Do not know know to handle extension *.jpg

It means the Agg library, which we use for rendering, does not know how to
create jpegs. Can you work with png's instead? They are a much better format
for plots and line art than jpegs.

Darren

···

On Monday 17 September 2007 01:12:46 pm David Montgomery wrote: