#! /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界面关闭
python调用gnuplot
最新推荐文章于 2025-03-31 14:20:13 发布