2014-07-19 33 views
0

我是新手編程,試圖建立一個代碼,詢問文件名,然後將其繪製到一個PNG文件。與python的調用文件Gnuplot

#!/usr/bin/env python 
#Gnuplot_graficas.py 
from numpy import * 
import Gnuplot, Gnuplot.funcutils 
fileofname = raw_input("enter the file name:") #here type the name of the file 
g = Gnuplot.Gnuplot(debug=1) 
g('set term png') 
g("set output 'fileofname.png'") 
Gnuplot.File(fileofname, using='1:2') #here i tried to call the file 

一些幫助,請

+3

什麼是你的問題?您是否遇到錯誤或不知道如何從那裏繼續? – t0mppa

回答

0
import Gnuplot 

filename = raw_input('enter the file name:') 
g = Gnuplot.Gnuplot() 
g('set term png') 
g('set output "{}"'.format(filename)) # {} gets substituted by filename 
f = Gnuplot.File(filename, using='1:2') 
print(f) 

創建一個給定的名稱和產量<Gnuplot.PlotItems._FileItem instance at 0x1046a5b48>在輸出的一個空文件。