if spectrum shorter than 1 second, use ms not s
authorPaul Brossier <piem@altern.org>
Wed, 2 Aug 2006 11:23:43 +0000 (11:23 +0000)
committerPaul Brossier <piem@altern.org>
Wed, 2 Aug 2006 11:23:43 +0000 (11:23 +0000)
if spectrum shorter than 1 second, use ms not s

python/aubio/gnuplot.py

index 3e508865cf694395f0652b17e3d6dbff0f184522..69c02b54b00260d92fd585e16110f4d62f3e5403 100644 (file)
@@ -122,7 +122,11 @@ def plot_spec(filename, outplot='',extension='', fileout=None, start=0, end=None
        data,time,freq = audio_to_spec(filename,minf=minf,maxf=maxf,bufsize=bufsize,hopsize=hopsize)
        xorig = 0.
        if not noaxis:
-               g.xlabel('Time (s)')
+               if max(time) < 1.:
+                       time = [t*1000. for t in time]
+                       g.xlabel('Time (ms)')
+               else:
+                       g.xlabel('Time (s)')
                g.ylabel('Frequency (Hz)')
        g('set size %f,%f' % (xsize, ysize))
        g('set pm3d map')