Cutting of unused frequencies in specgram matplotlib

后端 未结 4 2183
醉话见心
醉话见心 2021-02-06 05:04

I have a signal with sampling rate 16e3, its frequency range is from 125 to 1000 Hz. So if i plot a specgram i get a pretty small colorrange because of all the unused frequencys

4条回答
  •  我寻月下人不归
    2021-02-06 05:50

    specgram() returns (Pxx, freqs, bins, im), where im is AxesImage instance [1]. You could use it to set the limits of your plot:

    Pxx, freqs, bins, im = plt.specgram(signal, Fs=fs)
    im.set_ylim((125,1000))
    

    [1] http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.specgram

提交回复
热议问题