Customize stream.plot()

Hi all,

I have an obspy stream object containing mutliple channels. What I want is using obspy’s plot function and then add a avertical line into each channel (e.g. theo. EQ arrivals). To do smething likle this, I found this obspy GitHub discussion:

https://github.com/obspy/obspy/issues/522

(basically, set option show=False and keep going …)

However, I don’t get this to work. I DO NOT want to build my plots from the scratch, i.e. using Matplotlib’s standard functions. I simply would like to add very minor stuff. Can this be done and if so, has anyone a minimal working example for me?

Thanks a lot in advance!
John

This should get you started:

from obspy import read
st = read()
fig = st.plot(show=False, handle=True)

import matplotlib.pyplot as plt
ax = fig.axes[-1]
ax.set_xlabel("My x label")

t = st[0].stats.starttime + 2
ax.axvline(t.matplotlib_date)
plt.show()

cheers,
T

Hello T,

Thank you, it worked. The answer was more obvious than “figured”. :slight_smile:

Nice weekend to all!