Index: python/aubio/gnuplot.py
===================================================================
--- python/aubio/gnuplot.py	(revision 0ab19df22676e5ef57ae16f014b7c0f6d4c91085)
+++ python/aubio/gnuplot.py	(revision 33cf5416171abbf82de0baae4735b67edf219e09)
@@ -20,7 +20,4 @@
 	 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 """
-
-
-__notesheight = 0.25
 
 
@@ -46,14 +43,13 @@
 	return time,data
 
-def plot_audio(filenames, g, start=0, end=None, noaxis=None,xsize=1.,ysize=1.):
+def plot_audio(filenames, g, options):
 	d = []
 	todraw = len(filenames)
 	xorig = 0.
 	xratio = 1./todraw
-	#g('set rmargin 7')
 	g('set multiplot;')
 	while (len(filenames)):
 		time,data = audio_to_array(filenames.pop(0))
-		if not noaxis and todraw==1:
+		if todraw==1:
 			if max(time) < 1.:
 				time = [t*1000. for t in time]
@@ -63,5 +59,5 @@
 			g.ylabel('Amplitude')
 		d.append(make_audio_plot(time,data))
-		g('set size %f,%f;' % (xsize*xratio,ysize) )
+		g('set size %f,%f;' % (options.xsize*xratio,options.ysize) )
 		g('set origin %f,0.;' % (xorig) )
 		g('set style data lines; \
@@ -69,5 +65,5 @@
 			set xrange [0:%f]' % time[-1]) 
 		g.plot(d.pop(0))
-		xorig += xsize*xratio 
+		xorig += options.xsize*xratio 
 	g('unset multiplot;')
 
@@ -116,32 +112,32 @@
 	return data,time,freq
 
-def plot_spec(filename, g, start=0, end=None, noaxis=None,log=1, minf=0, maxf= 0, xsize = 1., ysize = 1.,bufsize=8192, hopsize=1024):
+def plot_spec(filename, g, options):
 	import Gnuplot
-	data,time,freq = audio_to_spec(filename,minf=minf,maxf=maxf,bufsize=bufsize,hopsize=hopsize)
+	data,time,freq = audio_to_spec(filename,
+    minf=options.minf,maxf=options.maxf,
+    bufsize=options.bufsize,hopsize=options.hopsize)
 	xorig = 0.
-	if not noaxis:
-		if max(time) < 1.:
-			time = [t*1000. for t in time]
-			g.xlabel('Time (ms)')
-		else:
-			g.xlabel('Time (s)')
-		if xsize < 0.5 and not log and max(time) > 1.:
-			freq = [f/1000. for f in freq]
-			minf /= 1000.
-			maxf /= 1000.
-			g.ylabel('Frequency (kHz)')
-		else:
-			g.ylabel('Frequency (Hz)')
+	if max(time) < 1.:
+		time = [t*1000. for t in time]
+		g.xlabel('Time (ms)')
+	else:
+		g.xlabel('Time (s)')
+	if options.xsize < 0.5 and not options.log and max(time) > 1.:
+		freq = [f/1000. for f in freq]
+		options.minf /= 1000.
+		options.maxf /= 1000.
+		g.ylabel('Frequency (kHz)')
+	else:
+		g.ylabel('Frequency (Hz)')
 	g('set pm3d map')
 	g('set palette rgbformulae -25,-24,-32')
-	#g('set lmargin 4')
 	g('set cbtics 20')
 	#g('set colorbox horizontal')
 	g('set xrange [0.:%f]' % time[-1]) 
-	if log:
+	if options.log:
 		g('set log y')
-		g('set yrange [%f:%f]' % (max(10,minf),maxf))
+		g('set yrange [%f:%f]' % (max(10,options.minf),options.maxf))
 	else:
-		g('set yrange [%f:%f]' % (minf,maxf))
+		g('set yrange [%f:%f]' % (options.minf,options.maxf))
 	g.splot(Gnuplot.GridData(data,time,freq, binary=1))
 	#xorig += 1./todraw
@@ -171,10 +167,22 @@
           action="store", dest="ysize", default=1., 
           type='float',help="define ysize for plot")
-  parser.add_option("-d","--debug",
+  parser.add_option("--debug",
           action="store_true", dest="debug", default=False, 
           help="use gnuplot debug mode")
-  parser.add_option("-p","--persist",
+  parser.add_option("--persist",
           action="store_false", dest="persist", default=True, 
           help="do not use gnuplot persistant mode")
+  parser.add_option("--lmargin",
+          action="store", dest="lmargin", default=None, 
+          type='int',help="define left margin for plot")
+  parser.add_option("--rmargin",
+          action="store", dest="rmargin", default=None, 
+          type='int',help="define right margin for plot")
+  parser.add_option("--bmargin",
+          action="store", dest="bmargin", default=None, 
+          type='int',help="define bottom margin for plot")
+  parser.add_option("--tmargin",
+          action="store", dest="tmargin", default=None, 
+          type='int',help="define top margin for plot")
   parser.add_option("-O","--outplot",
           action="store", dest="outplot", default=None, 
@@ -192,4 +200,8 @@
   else: exit("ERR: unknown plot extension")
   g('set terminal %s' % extension)
+  if options.lmargin: g('set lmargin %i' % options.lmargin)
+  if options.rmargin: g('set rmargin %i' % options.rmargin)
+  if options.bmargin: g('set bmargin %i' % options.bmargin)
+  if options.tmargin: g('set tmargin %i' % options.tmargin)
   if outplot != "stdout":
     g('set output \'%s%s\'' % (outplot,ext))
Index: python/aubioplot-audio
===================================================================
--- python/aubioplot-audio	(revision 0ab19df22676e5ef57ae16f014b7c0f6d4c91085)
+++ python/aubioplot-audio	(revision 33cf5416171abbf82de0baae4735b67edf219e09)
@@ -29,5 +29,3 @@
 
 g = gnuplot_create(outplot,extension,options)
-plot_audio(options.filename.split(','), g,
-  xsize=options.xsize,
-  ysize=options.ysize)
+plot_audio(options.filename.split(','), g, options)
Index: python/aubioplot-spec
===================================================================
--- python/aubioplot-spec	(revision 0ab19df22676e5ef57ae16f014b7c0f6d4c91085)
+++ python/aubioplot-spec	(revision 33cf5416171abbf82de0baae4735b67edf219e09)
@@ -49,6 +49,3 @@
 
 g = gnuplot_create(outplot,extension,options)
-plot_spec(filename, g, log=options.log,
-  maxf = options.maxf, minf = options.minf, 
-  xsize = options.xsize, ysize = options.ysize,
-  bufsize = options.bufsize, hopsize = options.hopsize)
+plot_spec(filename, g, options)
