Skip to content

Commit

Permalink
DOC: improve figures in demo/wp_scalogram.py (#769)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
omersayli authored Dec 4, 2024
1 parent 7d32750 commit 5c1fb33
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions demo/wp_scalogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@
# Show spectrogram and wavelet packet coefficients
fig2 = plt.figure()
ax2 = fig2.add_subplot(211)
ax2.specgram(data, NFFT=64, noverlap=32, Fs=2, cmap=cmap,
ax2.specgram(data, NFFT=64, noverlap=32, Fs=512, cmap=cmap,
interpolation='bilinear')
ax2.set_title("Spectrogram of signal")
ax3 = fig2.add_subplot(212)
ax3.imshow(values, origin='upper', extent=[-1, 1, -1, 1],
interpolation='nearest')
ax3.imshow(values, origin='lower', extent=[0, 1, 0, len(values)],
interpolation='nearest', aspect='auto')
ax3.set_yticks(np.arange(0.5, len(labels) + 0.5), labels)
ax3.set_title("Wavelet packet coefficients")


Expand Down

0 comments on commit 5c1fb33

Please sign in to comment.