Showing specific values in an STFT plot I have a short term fourier transform plot that I plot using matplotlib's pcolormesh() function:

If I zoom in the plot, I see this:

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(&quot;Frequency (Hz)&quot;)
plt.xlabel(&quot;Time (s)&quot;)
plt.title(&quot;Sort Term FFT&quot;)
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.
Also, sampleFreq and segmentTimes are simple lists but stftX is a list of lists.
Use matplotlib.pyplot's axis() function as follows:
# show section based on bandpass filter cut-off frequencies
plt.title(&quot;Zoomed Short Term Fourier Transform&quot;)
plt.xlabel(&quot;Time (s)&quot;)
plt.ylabel(&quot;Frequency Magnitude&quot;)
plt.pcolormesh(self.segment_times, self.sample_freq, self.abs_stft, shading='gouraud')
plt.axis([self.segment_times[0], self.segment_times[-1], high_pass, low_pass])

plt.show()

where high_pass and low_pass are the frequency cut-offs within which you want to display the y-axis data.