0

First, I display the waveform by SAC file and I want to plot a spectrogram.

st = read('SAC file HERE', header=0, index_col=0, parse_dates=True, squeeze=True)
pyplot.show()
st.plot()

That will show the waveform, so how can I put it in a spectrogram?

Robert
  • 7,394
  • 40
  • 45
  • 64
  • Please google [python plot spectrogram](https://www.google.com/search?q=python+plot+spectrogram&rlz=1C1CHBF_enUS859US859&oq=python+plot+spectrogram&aqs=chrome..69i57j0i512j0i22i30i625j0i22i30j0i22i30i625l2j0i22i30j69i60.4368j0j7&sourceid=chrome&ie=UTF-8) before posting. Also you must include data or something so that we can run your code to help debug, – georgwalker45 Feb 21 '23 at 23:47

1 Answers1

0

This is an example:

import obspy

st=obspy.read("https://examples.obspy.org/RJOB_061005_072159.ehz.new")

st.spectrogram(log=True, title='BW.RJOB ' + str(st[0].stats.starttime))
DaveL17
  • 1,673
  • 7
  • 24
  • 38
Pragnath
  • 1
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 15 '23 at 23:21