From 4f2c28cb07149d6a9fc080ecdcb1a04f66d6011f Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Wed, 18 Dec 2013 00:42:17 -0500 Subject: [PATCH] python/demos/: minor plot improvements --- python/demos/demo_mel-energy.py | 3 ++- python/demos/demo_pitch.py | 12 ++++++++---- python/demos/demo_specdesc.py | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/python/demos/demo_mel-energy.py b/python/demos/demo_mel-energy.py index c6712074..ac098639 100755 --- a/python/demos/demo_mel-energy.py +++ b/python/demos/demo_mel-energy.py @@ -61,8 +61,9 @@ if 1: ax.xaxis.set_visible(False) ax.yaxis.set_visible(False) ax.axis(xmax = all_desc_times[-1], xmin = all_desc_times[0]) - ax.annotate('band %d' % i, xy=(-10, 10), xycoords='axes points', + ax.annotate('band %d' % i, xy=(-10, 0), xycoords='axes points', horizontalalignment='right', verticalalignment='bottom', + size = 'xx-small', ) set_xlabels_sample2time( ax, all_desc_times[-1], samplerate) #plt.ylabel('spectral descriptor value') diff --git a/python/demos/demo_pitch.py b/python/demos/demo_pitch.py index 86f95c62..81f17cd4 100755 --- a/python/demos/demo_pitch.py +++ b/python/demos/demo_pitch.py @@ -56,9 +56,11 @@ confidences = array(confidences[skip:]) times = [t * hop_s for t in range(len(pitches))] fig = plt.figure() + ax1 = fig.add_subplot(311) ax1 = get_waveform_plot(filename, samplerate = samplerate, block_size = hop_s, ax = ax1) -ax1.set_xticklabels([]) +plt.setp(ax1.get_xticklabels(), visible = False) +ax1.set_xlabel('') def array_from_text_file(filename, dtype = 'float'): import os.path @@ -87,7 +89,8 @@ cleaned_pitches = ma.masked_where(confidences < tolerance, cleaned_pitches) ax2.plot(times, cleaned_pitches, '.-') #ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() ) #ax2.axis( ymin = 55, ymax = 70 ) -ax2.set_xticklabels([]) +plt.setp(ax2.get_xticklabels(), visible = False) +ax2.set_ylabel('f0 (Hz)') # plot confidence ax3 = fig.add_subplot(313, sharex = ax1) @@ -96,6 +99,7 @@ ax3.plot(times, confidences) # draw a line at tolerance ax3.plot(times, [tolerance]*len(confidences)) ax3.axis( xmin = times[0], xmax = times[-1]) -plt.show() +ax3.set_ylabel('condidence') set_xlabels_sample2time(ax3, times[-1], samplerate) -#plt.savefig(os.path.basename(filename) + '.png', dpi=200) +plt.show() +#plt.savefig(os.path.basename(filename) + '.svg') diff --git a/python/demos/demo_specdesc.py b/python/demos/demo_specdesc.py index ccf27a1c..b1520293 100755 --- a/python/demos/demo_specdesc.py +++ b/python/demos/demo_specdesc.py @@ -71,7 +71,7 @@ if 1: ax.xaxis.set_visible(False) ax.yaxis.set_visible(False) ax.axis(xmax = all_desc_times[-1], xmin = all_desc_times[0]) - ax.annotate(method, xy=(-10, 10), xycoords='axes points', + ax.annotate(method, xy=(-10, 0), xycoords='axes points', horizontalalignment='right', verticalalignment='bottom', ) set_xlabels_sample2time(ax, all_desc_times[-1], samplerate) -- 2.11.0