History

python/demos/: minor plot improvements

Paul Brossier committed 12 years ago

Commit 4f2c28c1 parent e5656033 files · +11 −6Browse files

Showing the changes to python (3 of 3 files). Show all

Unified · Split

3 files
  1. python/demos/demo_mel-energy.py +2 −1
  2. python/demos/demo_pitch.py +8 −4
  3. python/demos/demo_specdesc.py +1 −1
python/demos/demo_mel-energy.py+2−1
@@ -61,8 +61,9 @@ if 1: · 60 unmodified lines
61 ax.xaxis.set_visible(False)61 ax.xaxis.set_visible(False)
62 ax.yaxis.set_visible(False)62 ax.yaxis.set_visible(False)
63 ax.axis(xmax = all_desc_times[-1], xmin = all_desc_times[0])63 ax.axis(xmax = all_desc_times[-1], xmin = all_desc_times[0])
64 ax.annotate('band %d' % i, xy=(-10, 10), xycoords='axes points',64 ax.annotate('band %d' % i, xy=(-10, 0), xycoords='axes points',
65 horizontalalignment='right', verticalalignment='bottom',65 horizontalalignment='right', verticalalignment='bottom',
66 size = 'xx-small',
66 )67 )
67 set_xlabels_sample2time( ax, all_desc_times[-1], samplerate) 68 set_xlabels_sample2time( ax, all_desc_times[-1], samplerate)
68 #plt.ylabel('spectral descriptor value')69 #plt.ylabel('spectral descriptor value')
python/demos/demo_pitch.py+8−4
@@ -56,9 +56,11 @@ confidences = array(confidences[skip:]) · 55 unmodified lines
56times = [t * hop_s for t in range(len(pitches))]56times = [t * hop_s for t in range(len(pitches))]
57 57
58fig = plt.figure()58fig = plt.figure()
59
59ax1 = fig.add_subplot(311)60ax1 = fig.add_subplot(311)
60ax1 = get_waveform_plot(filename, samplerate = samplerate, block_size = hop_s, ax = ax1)61ax1 = get_waveform_plot(filename, samplerate = samplerate, block_size = hop_s, ax = ax1)
61ax1.set_xticklabels([])62plt.setp(ax1.get_xticklabels(), visible = False)
63ax1.set_xlabel('')
62 64
63def array_from_text_file(filename, dtype = 'float'):65def array_from_text_file(filename, dtype = 'float'):
64 import os.path66 import os.path
@@ -87,7 +89,8 @@ cleaned_pitches = ma.masked_where(confidences < tolerance, cleaned_pitches) · 22 unmodified lines
87ax2.plot(times, cleaned_pitches, '.-')89ax2.plot(times, cleaned_pitches, '.-')
88#ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() )90#ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() )
89#ax2.axis( ymin = 55, ymax = 70 )91#ax2.axis( ymin = 55, ymax = 70 )
90ax2.set_xticklabels([])92plt.setp(ax2.get_xticklabels(), visible = False)
93ax2.set_ylabel('f0 (Hz)')
91 94
92# plot confidence95# plot confidence
93ax3 = fig.add_subplot(313, sharex = ax1)96ax3 = fig.add_subplot(313, sharex = ax1)
@@ -96,6 +99,7 @@ ax3.plot(times, confidences) · 2 unmodified lines
96# draw a line at tolerance99# draw a line at tolerance
97ax3.plot(times, [tolerance]*len(confidences))100ax3.plot(times, [tolerance]*len(confidences))
98ax3.axis( xmin = times[0], xmax = times[-1])101ax3.axis( xmin = times[0], xmax = times[-1])
99plt.show()102ax3.set_ylabel('condidence')
100set_xlabels_sample2time(ax3, times[-1], samplerate)103set_xlabels_sample2time(ax3, times[-1], samplerate)
101#plt.savefig(os.path.basename(filename) + '.png', dpi=200)104plt.show()
105#plt.savefig(os.path.basename(filename) + '.svg')
python/demos/demo_specdesc.py+1−1
@@ -71,7 +71,7 @@ if 1: · 70 unmodified lines
71 ax.xaxis.set_visible(False)71 ax.xaxis.set_visible(False)
72 ax.yaxis.set_visible(False)72 ax.yaxis.set_visible(False)
73 ax.axis(xmax = all_desc_times[-1], xmin = all_desc_times[0])73 ax.axis(xmax = all_desc_times[-1], xmin = all_desc_times[0])
74 ax.annotate(method, xy=(-10, 10), xycoords='axes points',74 ax.annotate(method, xy=(-10, 0), xycoords='axes points',
75 horizontalalignment='right', verticalalignment='bottom',75 horizontalalignment='right', verticalalignment='bottom',
76 )76 )
77 set_xlabels_sample2time(ax, all_desc_times[-1], samplerate)77 set_xlabels_sample2time(ax, all_desc_times[-1], samplerate)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t