带网格的Python SAC绘图
我需要使用.sac文件中的信息并根据网格进行绘制。我知道使用各种ObsPy函数可以使用带网格的Python SAC绘图,python,plot,Python,Plot,我需要使用.sac文件中的信息并根据网格进行绘制。我知道使用各种ObsPy函数可以使用st.plot()绘制地震图,但我似乎无法在网格上绘制地震图。我还尝试了下面给出的示例“”,但在尝试将x轴配置为使用UTCDatetime时遇到了问题。我不熟悉python和这类编程,因此非常感谢您的任何建议/帮助 使用的各种资源: “” “”流的plot()方法实际上会自动生成网格,例如,如果您使用默认示例并通过以下方式进行打印: from obspy.core import read st = read()
st.plot()
绘制地震图,但我似乎无法在网格上绘制地震图。我还尝试了下面给出的示例“”,但在尝试将x轴配置为使用UTCDatetime时遇到了问题。我不熟悉python和这类编程,因此非常感谢您的任何建议/帮助
使用的各种资源:
“”
“”流的
plot()
方法实际上会自动生成网格,例如,如果您使用默认示例并通过以下方式进行打印:
from obspy.core import read
st = read() # without filename an example file is loaded
tr = st[0] # we will use only the first channel
tr.plot()
您可能需要使用中指出的勾号数
、勾号格式
和勾号旋转
参数
但是,如果需要更多控制,可以将matplotlib
图形作为输入参数传递给plot()
方法:
from obspy.core import read
import matplotlib.pyplot as plt
fig = plt.figure()
st = read('/path/to/file.sac')
st.plot(fig=fig)
# at this point do whatever you want with your figure, e.g.
fig.gca().set_axis_off()
# finally display your figure
fig.show()
希望有帮助。流
的plot()
方法实际上会自动生成网格,例如,如果您使用默认示例并通过以下方式进行绘制:
from obspy.core import read
st = read() # without filename an example file is loaded
tr = st[0] # we will use only the first channel
tr.plot()
您可能需要使用中指出的勾号数
、勾号格式
和勾号旋转
参数
但是,如果需要更多控制,可以将matplotlib
图形作为输入参数传递给plot()
方法:
from obspy.core import read
import matplotlib.pyplot as plt
fig = plt.figure()
st = read('/path/to/file.sac')
st.plot(fig=fig)
# at this point do whatever you want with your figure, e.g.
fig.gca().set_axis_off()
# finally display your figure
fig.show()
希望能有帮助