obspy / obspy

ObsPy: A Python Toolbox for seismology/seismological observatories.

Home Page:https://www.obspy.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'ArtistList' object has no attribute 'remove' when "un-zooming" a stream plot

filefolder opened this issue · comments

Avoid duplicates

  • I searched existing issues

Bug Summary

Minor but annoying bug when clicking the "home" button after zooming in on a plotted stream. The red Warning: Zooming into MinMax Plot! text in the corner isn't being cleared. Before I delve into it I figure someone may already be aware of whatever matplotlib (?) thing has changed.

st.plot()

Installed gtk4 event loop hook.
Traceback (most recent call last):
  File "/home/seis/.local/lib/python3.11/site-packages/matplotlib/cbook/__init__.py", line 304, in process
    func(*args, **kwargs)
  File "/home/seis/.local/lib/python3.11/site-packages/obspy/imaging/waveform.py", line 1445, in _warn_on_xaxis_zoom
    self._remove_zoomlevel_warning_text()
  File "/home/seis/.local/lib/python3.11/site-packages/obspy/imaging/waveform.py", line 1457, in _remove_zoomlevel_warning_text
    ax.texts.remove(self._minmax_warning_text)
    ^^^^^^^^^^^^^^^
AttributeError: 'ArtistList' object has no attribute 'remove'

Code to Reproduce

1) st.plot()

2) zoom in with the magnifying glass

3) click the "home" icon to resume the original view

Error Traceback

No response

ObsPy Version?

1.4.0

Operating System?

Debian 12

Python Version?

3.11

Installation Method?

pip

I've come across this API change in mpl 3.6 in megies/obspyck#104. Should be an easy fix. Thanks for the report!

@filefolder should be fixed by above PR, tested it locally as well