Changeset 0ab19df for python/aubio/gnuplot.py
- Timestamp:
- Aug 2, 2006, 5:25:09 PM (18 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 33cf541
- Parents:
- 32fa8e8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/aubio/gnuplot.py
r32fa8e8 r0ab19df 163 163 return Gnuplot.Data(x,y,with='lines') 164 164 165 def gnuplot_create(outplot='',extension='',debug=0,persist=1, xsize=1., ysize=1.): 166 import Gnuplot 167 g = Gnuplot.Gnuplot(debug=debug, persist=persist) 168 if not extension or not outplot: return g 169 if extension == 'ps': ext, extension = '.ps' , 'postscript' 170 elif extension == 'eps': ext, extension = '.eps' , 'postscript enhanced' 171 elif extension == 'epsc': ext, extension = '.eps' , 'postscript enhanced color' 172 elif extension == 'png': ext, extension = '.png', 'png' 173 elif extension == 'svg': ext, extension = '.svg', 'svg' 174 else: exit("ERR: unknown plot extension") 175 g('set terminal %s' % extension) 176 if outplot != "stdout": 177 g('set output \'%s%s\'' % (outplot,ext)) 178 g('set size %f,%f' % (xsize, ysize)) 179 return g 165 def gnuplot_addargs(parser): 166 """ add common gnuplot argument to OptParser object """ 167 parser.add_option("-x","--xsize", 168 action="store", dest="xsize", default=1., 169 type='float',help="define xsize for plot") 170 parser.add_option("-y","--ysize", 171 action="store", dest="ysize", default=1., 172 type='float',help="define ysize for plot") 173 parser.add_option("-d","--debug", 174 action="store_true", dest="debug", default=False, 175 help="use gnuplot debug mode") 176 parser.add_option("-p","--persist", 177 action="store_false", dest="persist", default=True, 178 help="do not use gnuplot persistant mode") 179 parser.add_option("-O","--outplot", 180 action="store", dest="outplot", default=None, 181 help="save plot to output.{ps,png}") 182 183 def gnuplot_create(outplot='',extension='', options=None): 184 import Gnuplot 185 g = Gnuplot.Gnuplot(debug=options.debug, persist=options.persist) 186 if not extension or not outplot: return g 187 if extension == 'ps': ext, extension = '.ps' , 'postscript' 188 elif extension == 'eps': ext, extension = '.eps' , 'postscript enhanced' 189 elif extension == 'epsc': ext, extension = '.eps' , 'postscript enhanced color' 190 elif extension == 'png': ext, extension = '.png', 'png' 191 elif extension == 'svg': ext, extension = '.svg', 'svg' 192 else: exit("ERR: unknown plot extension") 193 g('set terminal %s' % extension) 194 if outplot != "stdout": 195 g('set output \'%s%s\'' % (outplot,ext)) 196 g('set size %f,%f' % (options.xsize, options.ysize)) 197 return g
Note: See TracChangeset
for help on using the changeset viewer.