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
6161 ax.xaxis.set_visible(False)
6262 ax.yaxis.set_visible(False)
6363 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',
6565 horizontalalignment='right', verticalalignment='bottom',
66+ size = 'xx-small',
6667 )
6768 set_xlabels_sample2time( ax, all_desc_times[-1], samplerate)
6869 #plt.ylabel('spectral descriptor value')
python/demos/demo_pitch.py+8−4
@@ -56,9 +56,11 @@ confidences = array(confidences[skip:]) · 55 unmodified lines
5656 times = [t * hop_s for t in range(len(pitches))]
5757
5858 fig = plt.figure()
59+
5960 ax1 = fig.add_subplot(311)
6061 ax1 = get_waveform_plot(filename, samplerate = samplerate, block_size = hop_s, ax = ax1)
61−ax1.set_xticklabels([])
62+plt.setp(ax1.get_xticklabels(), visible = False)
63+ax1.set_xlabel('')
6264
6365 def array_from_text_file(filename, dtype = 'float'):
6466 import os.path
@@ -87,7 +89,8 @@ cleaned_pitches = ma.masked_where(confidences < tolerance, cleaned_pitches) · 22 unmodified lines
8789 ax2.plot(times, cleaned_pitches, '.-')
8890 #ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() )
8991 #ax2.axis( ymin = 55, ymax = 70 )
90−ax2.set_xticklabels([])
92+plt.setp(ax2.get_xticklabels(), visible = False)
93+ax2.set_ylabel('f0 (Hz)')
9194
9295 # plot confidence
9396 ax3 = fig.add_subplot(313, sharex = ax1)
@@ -96,6 +99,7 @@ ax3.plot(times, confidences) · 2 unmodified lines
9699 # draw a line at tolerance
97100 ax3.plot(times, [tolerance]*len(confidences))
98101 ax3.axis( xmin = times[0], xmax = times[-1])
99−plt.show()
102+ax3.set_ylabel('condidence')
100103 set_xlabels_sample2time(ax3, times[-1], samplerate)
101−#plt.savefig(os.path.basename(filename) + '.png', dpi=200)
104+plt.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
7171 ax.xaxis.set_visible(False)
7272 ax.yaxis.set_visible(False)
7373 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',
7575 horizontalalignment='right', verticalalignment='bottom',
7676 )
7777 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