From: Cuneyt E. <cun...@gm...> - 2010-10-09 21:31:10
|
Hi, I wan to plot more than one curve in the same graph using same function with different parameters. The following code works without problem. from numpy import * import Gnuplot gp = Gnuplot.Gnuplot(persist=1) x = arange(0,1,0.01,dtype='float_') d1 = Gnuplot.Data(x, ozfonksiyon(omegalar[0],x), title='1. ozdeger', with_='lines') d2 = Gnuplot.Data(x, ozfonksiyon(omegalar[1],x), title='2. ozdeger', with_='lines') d3 = Gnuplot.Data(x, ozfonksiyon(omegalar[2],x), title='3. ozdeger', with_='lines') d4 = Gnuplot.Data(x, ozfonksiyon(omegalar[3],x), title='4. ozdeger', with_='lines') d5 = Gnuplot.Data(x, ozfonksiyon(omegalar[4],x), title='5. ozdeger', with_='lines') gp.plot(d1,d2,d3,d4,d5) in this code ozfonksiyon and omegalar are user defined functions. But what I want is to create plotitems (d1,d2,d3,d4,d5) in a for loop. I modified the code like below, for ii in range(n): datalar.append("Gnuplot.Data(x, ozfonksiyon(omegalar["+str(ii)+"],x), with_='lines')") gp.plot(*datalar) I get this error. /usr/bin/python -u "/media/disk/doktora_tezi/tek_cubuk/python_files/CALISAN KOD/fix_free_controlled_parametrelerin_degisimi_deneme.py" gnuplot> plot Gnuplot.Data(x, ozfonksiyon(omegalar[0],x), with_='lines') , Gnuplot.Data(x, ozfonksiyon(omegalar[1],x), with_='lines') , Gnuplot.Data(x, ozfonksiyon(omegalar[2],x), with_='lines') , Gnuplot.Data(x, ozfonksiyon(omegalar[3],x), with_='lines') , Gnuplot.Data(x, ozfonksiyon(omegalar[4],x), with_='lines') ^ line 0: ':' expected What am I doing wrong? Best regards, Cuneyt. |