Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -233,8 +233,8 @@ def plot_pitch(filename, pitch, samplerate=44100., hopsize=512, outplot=None): · 232 unmodified lines | ||
| 233 | 233 | g('unset multiplot') |
| 234 | 234 | |
| 235 | 235 | def gnuplot_init(outplot,debug=0,persist=1): |
| 236 | − import Gnuplot | |
| 237 | 236 | # prepare the plot |
| 237 | + import Gnuplot | |
| 238 | 238 | g = Gnuplot.Gnuplot(debug=debug, persist=persist) |
| 239 | 239 | if outplot == 'stdout': |
| 240 | 240 | g("set terminal png fontfile 'p052023l.pfb'") |
| @@ -245,3 +245,16 @@ def gnuplot_init(outplot,debug=0,persist=1): · 4 unmodified lines | ||
| 245 | 245 | g('set terminal %s' % extension) |
| 246 | 246 | g('set output \'%s\'' % outplot) |
| 247 | 247 | return g |
| 248 | + | |
| 249 | +def gnuplot_create(outplot='',extension='',debug=0,persist=1): | |
| 250 | + import Gnuplot | |
| 251 | + g = Gnuplot.Gnuplot(debug=debug, persist=persist) | |
| 252 | + if not extension or not outplot: return g | |
| 253 | + if extension == 'ps': ext, extension = '.ps' , 'postscript' | |
| 254 | + elif extension == 'png': ext, extension = '.png', 'png' | |
| 255 | + elif extension == 'svg': ext, extension = '.svg', 'svg' | |
| 256 | + else: exit("ERR: unknown plot extension") | |
| 257 | + g('set terminal %s' % extension) | |
| 258 | + if outplot != "stdout": | |
| 259 | + g('set output \'roc-%s%s\'' % (outplot,ext)) | |
| 260 | + return g | |