From 0baafcf29a5823e722c57ce790e5f598fca4f925 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 23 Feb 2006 02:12:28 +0000 Subject: [PATCH] rewrite gnuplot_create rewrite gnuplot_create --- python/aubio/gnuplot.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/python/aubio/gnuplot.py b/python/aubio/gnuplot.py index c63459c8..881099a2 100644 --- a/python/aubio/gnuplot.py +++ b/python/aubio/gnuplot.py @@ -233,8 +233,8 @@ def plot_pitch(filename, pitch, samplerate=44100., hopsize=512, outplot=None): g('unset multiplot') def gnuplot_init(outplot,debug=0,persist=1): - import Gnuplot # prepare the plot + import Gnuplot g = Gnuplot.Gnuplot(debug=debug, persist=persist) if outplot == 'stdout': g("set terminal png fontfile 'p052023l.pfb'") @@ -245,3 +245,16 @@ def gnuplot_init(outplot,debug=0,persist=1): g('set terminal %s' % extension) g('set output \'%s\'' % outplot) return g + +def gnuplot_create(outplot='',extension='',debug=0,persist=1): + import Gnuplot + g = Gnuplot.Gnuplot(debug=debug, persist=persist) + if not extension or not outplot: return g + if extension == 'ps': ext, extension = '.ps' , 'postscript' + elif extension == 'png': ext, extension = '.png', 'png' + elif extension == 'svg': ext, extension = '.svg', 'svg' + else: exit("ERR: unknown plot extension") + g('set terminal %s' % extension) + if outplot != "stdout": + g('set output \'roc-%s%s\'' % (outplot,ext)) + return g -- 2.26.2