im sorry but i need help in plotting this graph on python, been doing it for the past 6hrs and i cannot generate the graph, would really really appreciate some help in it.

n=range(1,201,1)
L=0.016
data=[]
aetemplist=[]
dxlist=[]
ot=[]
nlist=[]

for i in n:
    etemp = finTempNum(i)
    ot.append(etemp)

    dx=L/i
    dxlist.append(dx)
    nlist.append(i)
    
    aetemp=finTemp(L)
    aetemplist.append(aetemp)
    
    error=aetemp+(0.1/100)*aetemp
    data.append(error)
    
for i in n:
    if finTempNum(i) <= error:
        print 'The number of nodes required=',i
        break
      
pylab.semilogx(dxlist,ot,label='Numerical')
pylab.semilogx(dxlist,aetemplist,label='Analytical')
pylab.semilogx(dxlist,data,label='0.1% Analytical')

v=[(dxlist[-1]),(dxlist[0]),460.0,470.0]
pylab.axis(v)
pylab.legend(loc=0)
pylab.xlabel('dx(m)')
pylab.ylabel('Rate of heat transfer')
pylab.title('Rate of heat transfer against dx')
pylab.savefig('Task_8')
pylab.show ()

and the errors that come out are,
Traceback (most recent call last):
File "C:/Users/thane/Desktop/task_8.doing1.py", line 89, in <module>
pylab.semilogx(dxlist,ot,label='Numerical')
File "C:\Python25\Lib\site-packages\matplotlib\pylab.py", line 2112, in semilogx
ret = gca().semilogx(*args, **kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 2674, in semilogx
l = self.plot(*args, **kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 2535, in plot
for line in self._get_lines(*args, **kwargs):
File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 421, in _grab_next_args
for seg in self._plot_2_args(remaining, **kwargs):
File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 337, in _plot_2_args
x, y, multicol = self._xy_from_xy(x, y)
File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 261, in _xy_from_xy
y = ma.asarray(y)
File "C:\Python25\Lib\site-packages\numpy\core\ma.py", line 2122, in asarray
return array(data, dtype=dtype, copy=0)
File "C:\Python25\Lib\site-packages\numpy\core\ma.py", line 566, in __init__
c = numeric.array(data, dtype=tc, copy=True, order=order)
ValueError: setting an array element with a sequence

yup i read it but im still unable to troubleshoot to plot the graph out. the error msg keeps coming

Just some initial observations:

How are you importing pylab?
Do you have module numpy installed?
Pylab needs that internally.

Where does finTempNum come from?
If it's a list then use:
etemp = finTempNum

This article has been dead for over six months. Start a new discussion instead.