Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fb2ea82

Browse files
committed
DOC: clarity specgram's returned values
1 parent fd41c9d commit fb2ea82

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

examples/images_contours_and_fields/specgram_demo.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
nse = 0.01 * np.random.random(size=len(t))
2525

2626
x = s1 + s2 + nse # the signal
27-
NFFT = 1024 # the length of the windowing segments
27+
NFFT = 1024 # the length of the windowing segments
2828
Fs = int(1.0 / dt) # the sampling frequency
2929

30-
# Pxx is the segments x freqs array of instantaneous power, freqs is
31-
# the frequency vector, bins are the centers of the time bins in which
32-
# the power is computed, and im is the matplotlib.image.AxesImage
33-
# instance
3430
fig, (ax1, ax2) = plt.subplots(nrows=2)
35-
line, = ax1.plot(t, x)
31+
ax1.plot(t, x)
3632
Pxx, freqs, bins, im = ax2.specgram(x, NFFT=NFFT, Fs=Fs, noverlap=900)
33+
# The `specgram` method returns 4 objects. They are:
34+
# - Pxx: the periodogram
35+
# - freqs: the frequency vector
36+
# - bins: the centers of the time bins
37+
# - im: the matplotlib.image.AxesImage instance representing the data in the plot
3738
plt.show()

0 commit comments

Comments
 (0)