Changeset fb8bde7


Ignore:
Timestamp:
May 4, 2006, 5:02:01 PM (18 years ago)
Author:
Paul Brossier <piem@altern.org>
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:
45fcbb8
Parents:
fe4f78a
Message:

update pitch plot
update pitch plot

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/aubio/task/pitch.py

    rfe4f78a rfb8bde7  
    152152                return osil, esil, opit, epit, echr
    153153
    154         def plot(self,pitch,wplot,oplots,outplot=None):
     154        def plot(self,pitch,wplot,oplots,titles,outplot=None):
    155155                import Gnuplot
    156156
     
    159159                oplots.append(Gnuplot.Data(time,pitch,with='lines',
    160160                        title=self.params.pitchmode))
     161                titles.append(self.params.pitchmode)
    161162
    162163                       
    163         def plotplot(self,wplot,oplots,outplot=None,multiplot = 1, midi = 1):
     164        def plotplot(self,wplot,oplots,titles,outplot=None,multiplot = 1, midi = 1, truth = 1):
    164165                from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot
    165166                import re
     
    170171
    171172                # check if ground truth exists
    172                 timet,pitcht = self.gettruth()
    173                 if timet and pitcht:
    174                         oplots = [Gnuplot.Data(timet,pitcht,with='lines',
    175                                 title='ground truth')] + oplots
     173                if truth:
     174                        timet,pitcht = self.gettruth()
     175                        if timet and pitcht:
     176                                oplots = [Gnuplot.Data(timet,pitcht,with='lines',
     177                                        title='ground truth')] + oplots
    176178
    177179                t = Gnuplot.Data(0,0,with='impulses')
     
    181183                g('set multiplot')
    182184                # hack to align left axis
    183                 g('set lmargin 15')
     185                g('set lmargin 4')
     186                g('set rmargin 4')
    184187                # plot waveform and onsets
    185188                g('set size 1,0.3')
     
    188191                g('set xrange [0:%f]' % max(time))
    189192                g('set yrange [-1:1]')
     193                g('set noytics')
     194                g('set y2tics -1,1')
     195                g.xlabel('time (s)',offset=(0,0.8))
    190196                g.ylabel('amplitude')
    191197                g.plot(f)
     
    205211                        g.ylabel('midi')
    206212                        g('set yrange [%f:%f]' % (aubio_freqtomidi(self.params.pitchmin), aubio_freqtomidi(self.params.pitchmax)))
     213                        g('set y2tics %f,%f' % (round(aubio_freqtomidi(self.params.pitchmin)+.5),12))
    207214                g('set key right top')
    208215                g('set noclip one')
    209216                g('set format x ""')
    210217                if multiplot:
     218                        g('set tmargin 0')
    211219                        for i in range(len(oplots)):
    212220                                # plot onset detection functions
    213221                                g('set size 1,%f' % (0.7/(len(oplots))))
    214                                 g('set origin 0,%f' % (float(i)*0.7/(len(oplots))))
     222                                g('set origin 0,%f' % ((len(oplots)-float(i)-1)*0.7/(len(oplots))))
    215223                                g('set xrange [0:%f]' % max(time))
     224                                g('set nokey')
     225                                g.ylabel(titles[i])
     226                                g.xlabel('')
    216227                                g.plot(oplots[i])
    217228                else:
Note: See TracChangeset for help on using the changeset viewer.