trichter / rf

Receiver function calculation in seismology
MIT License
106 stars 62 forks source link

possible matplotlib bug in imaging.py #47

Closed filefolder closed 7 months ago

filefolder commented 7 months ago

Hi there,

Working through the Chile tutorial for a lab I'm putting together and hit a snag here:

pstream = read_rf(profilefile)
pstream.trim2(-5, 20, 'onset')
pstream.select(channel='??Q').normalize().plot_profile(scale=1.5, top='hist')
plt.gcf().set_size_inches(15, 10)
plt.show()
File ~/.local/lib/python3.11/site-packages/rf/imaging.py:318, in plot_profile(profile, fname, figsize, dpi, scale, fillcolors, trim, top, moveout_model)
    316 pd = model.calculate_delay_times(phase=phase, slowness=slowness)
    317 ax2 = ax.twinx()
--> 318 ax.get_shared_y_axes().join(ax, ax2)
    319 dkm = 50
    320 if profile[0].stats.endtime - profile[0].stats.onset > 50:

AttributeError: 'GrouperView' object has no attribute 'join'

matplotlib 3.8.2 so I suppose this is probably the issue.

Replacing line 318 with ax.sharey(ax2) solves it for me.

trichter commented 7 months ago

Hi!

Thanks a lot for reporting. Can you please double-check that you use the latest version? I think this was fixed with https://github.com/trichter/rf/commit/2f7984557b663ececa8d46bb6fd1e879f9c7ea99.

filefolder commented 7 months ago

oops! you are correct, for some reason I thought this was a fresh install. sorry!