I'm trying to make a scatter plot with python with the code attached
below. What weird is, pylab.show() doesn't work at all, though it
doesn't show any error message.

#d_PL is a dictionary,
#e.g. (8, 'Transportation', 'TKN(mg/l)') 2449891.61196,
#(8, 'Transportation', 'TKN(mg/l)') is one of the keys
#2449891.61196 is the TKN concentration

k are the keys of d_PL


y = []
x = []
LU = ['Forest', 'agriculture', 'Open_land', 'Residential',
'Institutional', 'commerical', 'Industrial', 'Transportation']
for n in LU:
    for key in k:
        if key[2] == 'TKN(mg/l)':
            if key[1] == n:
                y.append(float(d_PL[key]))
                x.append(int(key[0]))
                print x, y
    pylab.scatter(x, y, 'o', label = n)
    pylab.show()
    #pylab.savefig('trial.pdf')

#matplotlib.pyplot.savefig('trial.pdf')
#pylab.close()


Then I tried to save the plot to pdf file, using
pylab.savefig('trial.pdf'), it show error message as below:

Traceback (most recent call last):
  File "D:\MA_resevior\subbasin_LU\LU_PL.py", line 214, in <module>
    pylab.savefig('trial.pdf')
  File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 345,
in savefig
    return fig.savefig(*args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 990,
in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backend_bases.py",
line 1419, in print_figure
    **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backend_bases.py",
line 1313, in print_pdf
    return pdf.print_pdf(*args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backends
\backend_pdf.py", line 1901, in print_pdf
    self.figure.draw(renderer)
  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 772,
in draw
    for a in self.axes: a.draw(renderer)
  File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1612,
in draw
    a.draw(renderer)
  File "C:\Python25\Lib\site-packages\matplotlib\collections.py", line
770, in draw
    for x in self._sizes]
TypeError: unsupported operand type(s) for *: 'NotImplementedType' and
'int'


I searached online, and it says unsupported operand type(s) for *:
'NotImplementedType'  is a python developer's error. how to fix it?

I'd appreciate any advice you might give me.

Jen

Reply via email to