2014-07-19 1 views
0

저는 초보자 프로그래밍으로 파일 이름을 묻는 코드를 작성한 다음 png 파일에 그려 봅니다.파이썬과의 호출 파일 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>의 빈 파일을 작성하십시오.