python调用gnuplot

来源:互联网 发布:windows桌面文件路径 编辑:程序博客网 时间:2024/05/22 08:23
#! /usr/bin/python3.5     from subprocess import *  gnuplot= Popen('gnuplot',stdin = PIPE, stderr=PIPE,stdout=PIPE)  #gnuplot.stdin .write(b"set terminal jpeg \n")  #gnuplot.stdin .write(b"set output 'plot.jpg' \n")  #存到图片时候不会跳出gnuplot界面gnuplot.stdin .write(b"set xlabel 'sample' \n")  gnuplot.stdin .write(b"set ylabel 'value'\n")  gnuplot.stdin .write(b"set title 'svm' \n")  gnuplot.stdin .write(b"plot 'svmout\\plotdata.txt' using 1:2 with p pointsize 0.5  linetype 8,")  gnuplot.stdin .write(b" 'svmout\\plotdata.txt' using 1:3 with p pointsize 0.5  linetype 7 \n")  gnuplot.stdin .flush()input('Press the Return key to quit: ')#暂停一下,防止gnuplot界面自动关闭gnuplot.stdin .close()#这条语句执后gnuplot界面关闭

0 0
原创粉丝点击