2012-06-21 2 views
0

(예) '로 설정 키'가변 파라미터 I는 원하는 :파이썬 : GNUPLOT -

for datafile in glob.glob('*.dat') 
    d = Gnuplot.File(datafile, using='1:2', with_='l', title=datafile) 
    g("set key at xpos, [y variable position]) 
    g.plot(d) 

에서 [Y 가변 위치가 일부 간단한 함수 말하자면, Y = #graph * (일부 개수).

어떻게하면 (가장 좋은 해결책에 대해 아는 사람을주지 않겠습니까?

하프! 감사.

답변

0
g = Gnuplot.Gnuplot(debug=1) 
#xpos is always the same 
xpos=0.0 
for plotnr,datafile in enumerate(glob.glob('*.dat')): 
    #ypos as a function of the plot-number, e.g. 
    ypos=plotnr*2.0 
    g("set key at "+str(xpos)+","+str(ypos)) 
    d = Gnuplot.File(datafile, using='1:2', with_='l', title=datafile) 
    g.plot(d) 
+0

Raphael에게 감사드립니다. 덧붙여 말하자면, 내 파일 이름은 01-xxx.dat 형식이므로 다음과 같이 사용합니다 :'files = glob.glob ('* svb * .dat'); files.sort()'를 호출하십시오. – MarkWayne