Index: python/aubio/gnuplot.py
===================================================================
--- python/aubio/gnuplot.py	(revision 08f6688c7ac7ab967f7cca62cca4730fd168cd34)
+++ python/aubio/gnuplot.py	(revision 9b138a860a8a2939b8bd6aed7d5c460be0a4c8bd)
@@ -73,5 +73,5 @@
 	g.gnuplot('unset multiplot;')
 
-def audio_to_spec(filename,minf = 0, maxf = 0, lowthres = 0.):
+def audio_to_spec(filename,minf = 0, maxf = 0, lowthres = -20.):
 	from aubioclass import fvec,cvec,pvoc,sndfile
 	from math import log10
@@ -135,5 +135,5 @@
 		g('set yrange [%f:%f]' % (max(10,minf),maxf))
 		g('set log y')
-	g.splot(Gnuplot.GridData(data,time,freq, binary=1, title='mag. (dB)'))
+	g.splot(Gnuplot.GridData(data,time,freq, binary=1))
 	#xorig += 1./todraw
 
Index: python/aubio/task/onset.py
===================================================================
--- python/aubio/task/onset.py	(revision 08f6688c7ac7ab967f7cca62cca4730fd168cd34)
+++ python/aubio/task/onset.py	(revision 9b138a860a8a2939b8bd6aed7d5c460be0a4c8bd)
@@ -140,13 +140,14 @@
 
 
-	def plotplot(self,wplot,oplots,outplot=None):
-		from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot
+	def plotplot(self,wplot,oplots,outplot=None,extension=None,xsize=1.,ysize=1.,spectro=False):
+		from aubio.gnuplot import gnuplot_create, audio_to_array, make_audio_plot, audio_to_spec
 		import re
-		# audio data
-		time,data = audio_to_array(self.input)
-		wplot = [make_audio_plot(time,data)] + wplot
 		# prepare the plot
-		g = gnuplot_init(outplot)
-
+		g = gnuplot_create(outplot=outplot, extension=extension)
+		
+		if spectro:
+			g('set size %f,%f' % (xsize,1.3*ysize) )
+		else:
+			g('set size %f,%f' % (xsize,ysize) )
 		g('set multiplot')
 
@@ -161,6 +162,6 @@
 		for i in range(len(oplots)):
 			# plot onset detection functions
-			g('set size 1,%f' % (0.7/(len(oplots))))
-			g('set origin 0,%f' % ((len(oplots)-float(i)-1)*0.7/(len(oplots))))
+			g('set size %f,%f' % (xsize,0.7*ysize/(len(oplots))))
+			g('set origin 0,%f' % ((len(oplots)-float(i)-1)*0.7*ysize/(len(oplots))))
 			g('set xrange [0:%f]' % (self.lenofunc*self.params.step))
 			g('set nokey')
@@ -172,16 +173,44 @@
 			g.plot(*oplots[i][0])
 
+		if spectro:
+			import Gnuplot
+			minf = 50
+			maxf = 500 
+			data,time,freq = audio_to_spec(self.input,minf=minf,maxf=maxf)
+			g('set size %f,%f' % (1.24*xsize , 0.34*ysize) )
+			g('set origin %f,%f' % (-0.12,0.65*ysize))
+			g('set xrange [0.:%f]' % time[-1]) 
+			g('set yrange [%f:%f]' % (minf,maxf))
+			g('set pm3d map')
+			g('unset colorbox')
+			g('set lmargin 0')
+			g('set rmargin 0')
+			g('set tmargin 0')
+			g('set palette rgbformulae -25,-24,-32')
+			g.xlabel('')
+			g.ylabel('freq (Hz)')
+			#if log:
+			#	g('set yrange [%f:%f]' % (max(10,minf),maxf))
+			#	g('set log y')
+			g.splot(Gnuplot.GridData(data,time,freq, binary=1, title=''))
+			g('set lmargin 3')
+			g('set rmargin 6')
+			g('set origin 0,%f' % (1.0*ysize) ) 
+			g('set format x "%1.1f"')
+			g.xlabel('time (s)',offset=(0,1.))
+		else:
+			# plot waveform and onsets
+			g('set origin 0,%f' % (0.7*ysize) )
+			g.xlabel('time (s)',offset=(0,0.7))
+			g('set format y "%1f"')
+
+		g('set size %f,%f' % (1.*xsize, 0.3*ysize))
+		g('set title \'%s %s\'' % (re.sub('.*/','',self.input),self.title))
 		g('set tmargin 2')
-		g.xlabel('time (s)',offset=(0,0.7))
-		g('set format x "%1.1f"')
-		g('set format y "%1f"')
+		# audio data
+		time,data = audio_to_array(self.input)
+		wplot = [make_audio_plot(time,data)] + wplot
 		g('set y2tics -1,1')
 
-
-		g('set title \'%s %s\'' % (re.sub('.*/','',self.input),self.title))
-
-		# plot waveform and onsets
-		g('set size 1,0.3')
-		g('set origin 0,0.7')
 		g('set xrange [0:%f]' % max(time)) 
 		g('set yrange [-1:1]') 
Index: python/aubiocut
===================================================================
--- python/aubiocut	(revision 08f6688c7ac7ab967f7cca62cca4730fd168cd34)
+++ python/aubiocut	(revision 9b138a860a8a2939b8bd6aed7d5c460be0a4c8bd)
@@ -62,13 +62,22 @@
                           action="store_true", dest="plot", default=False, 
                           help="draw plot")
-	parser.add_option("-f","--function",
-			  action="store_true", dest="func", default=False, 
-			  help="print detection function")
+        parser.add_option("-x","--xsize",
+                          action="store", dest="xsize", default=1., 
+                          type='float', help="define xsize for plot")
+        parser.add_option("-y","--ysize",
+                          action="store", dest="ysize", default=1., 
+                          type='float', help="define ysize for plot")
+        parser.add_option("-f","--function",
+                          action="store_true", dest="func", default=False, 
+                          help="print detection function")
         parser.add_option("-n","--no-onsets",
                           action="store_true", dest="nplot", default=False, 
-                          help="plot only detection functions")
+                          help="do not plot detected onsets")
         parser.add_option("-O","--outplot",
                           action="store", dest="outplot", default=None, 
                           help="save plot to output.{ps,png}")
+        parser.add_option("-F","--spectrogram",
+                          action="store_true", dest="spectro", default=False,
+                          help="add spectrogram to the plot")
         parser.add_option("-v","--verbose",
                           action="store_true", dest="verbose", default=False,
@@ -131,5 +140,11 @@
 			print i 
 
-if options.plot: filetask.plotplot(wplot, oplots, outplot=options.outplot)
+if options.outplot:
+  extension = options.outplot.split('.')[-1] 
+  outplot = '.'.join(options.outplot.split('.')[:-1])
+else:
+  extension,outplot = None,None
+if options.plot: filetask.plotplot(wplot, oplots, outplot=outplot, extension=extension,
+  xsize=options.xsize,ysize=options.ysize,spectro=options.spectro)
 
 if options.cut:
