Now, I want the plot to just show the zoomed-in range on the y-axis - till 4 or 3 kHz. Is there any way to do this without having to manually zoom in? I want to do a comparison for multiple waveforms in the frequency range as this is my passband in the passband filter I apply on the data.
Here is the code I use to compute and plot the stft:
sampleFreq, segmentTimes, stftX = sp.stft(filteredY, fs) segmentTimes += (1.5 / 1000) plt.pcolormesh(segmentTimes, sampleFreq, np.abs(stftX), shading='gouraud') plt.ylabel("Frequency (Hz)") plt.xlabel("Time (s)") plt.title("Sort Term FFT") plt.show()
I add 1.5 to the
segmentTimes because I trim my original data from 1.5 to 2.5 ms, and for some reason, if I don't add 1.5 here, the stft starts from 0.0 s. And the division by 1000 is for conversion to seconds from milliseconds.
segmentTimes are simple lists but
stftX is a list of lists.