Skip to content

Commit 5c1fb33

Browse files
authored
DOC: improve figures in demo/wp_scalogram.py (#769)
In the second plot, updated Fs to 512; `ax2.specgram(data, NFFT=64, noverlap=32, Fs=512, cmap=cmap, interpolation='bilinear')` again in the second plot, added aspect='auto', and did corrections to the time (x axis) and y axis (scale) with `extent=[0, 1, 1, values.shape[0]]` ax3.imshow(values, origin='lower', extent=[0, 1, 1, values.shape[0]], interpolation='nearest', aspect='auto') Figure 2-subplot 2 in this version is compatible with Figure 1-subplot 2 y-axis labels for the wavelet packet names
1 parent 7d32750 commit 5c1fb33

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

demo/wp_scalogram.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@
3838
# Show spectrogram and wavelet packet coefficients
3939
fig2 = plt.figure()
4040
ax2 = fig2.add_subplot(211)
41-
ax2.specgram(data, NFFT=64, noverlap=32, Fs=2, cmap=cmap,
41+
ax2.specgram(data, NFFT=64, noverlap=32, Fs=512, cmap=cmap,
4242
interpolation='bilinear')
4343
ax2.set_title("Spectrogram of signal")
4444
ax3 = fig2.add_subplot(212)
45-
ax3.imshow(values, origin='upper', extent=[-1, 1, -1, 1],
46-
interpolation='nearest')
45+
ax3.imshow(values, origin='lower', extent=[0, 1, 0, len(values)],
46+
interpolation='nearest', aspect='auto')
47+
ax3.set_yticks(np.arange(0.5, len(labels) + 0.5), labels)
4748
ax3.set_title("Wavelet packet coefficients")
4849

4950

0 commit comments

Comments
 (0)