2012-06-21 32 views
0

可變參數欲:蟒: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 *(一些數)。

如何(以任何方式 - 我不給一個關於最優雅的解決方案的呼叫者)會這樣做?

Halp!謝謝。

回答

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

感謝拉斐爾。順便說一句,我的文件名的格式爲:01-xxx.dat,所以我使用:'files = glob.glob('* svb * .dat'); files.sort()'來訂購它們。 – MarkWayne