我正在使用 obspy 来查看一些水声数据,我需要将数据视为频谱图。频谱图似乎还可以,但我想在 y=100 标记附近切断我的情节的顶部(靠近奈奎斯特)。我在弄清楚如何限制 y 轴时遇到了很多麻烦。有人可以提供一些见解吗?
我的代码在下面,倒数第二个:
fig.axes[0].set_ylim(0,100)
我觉得应该可以工作,但是我收到一个错误,说“列表”对象没有属性“轴”。
import obspy
from obspy.clients.fdsn import Client
from obspy.imaging.spectrogram import spectrogram
client = Client("IRIS")
from obspy import UTCDateTime
import numpy as np
import matplotlib.pyplot as plt
# Retrieve waveform data
t1 = UTCDateTime("2020-02-13T09:02:00.000")
t2 = UTCDateTime("2020-02-13T09:28:00.000")
# get_waveforms expects (network, station, location, channel, start_time, end_time)
# One station/channel
st = client.get_waveforms("IM","H11S1","","EDH",t1,t2)
""" Plot the timeseries waveform """
st.plot()
""" Plot the spectrogram """
fig = st.spectrogram(log=False, dbscale=True, axes=None, title='Spectrogram', cmap='inferno', show=False)
fig.axes[0].set_ylim(0,100)
plt.show()