Skip to content

gwpy-plot raises NotImplementedError with matplotlib < 1.4

The gwpy-plot CLI ends up raising a NotImplementedError when the legend is removed with matplotlib < 1.4:

$ gwpy-plot timeseries --chan L1:OAF-CAL_DARM_DQ --start 1102766651 --out /tmp/cli-01.png
Traceback (most recent call last):
  File "/home/duncan.macleod/.local/bin/gwpy-plot", line 5, in <module>
    pkg_resources.run_script('gwpy==0.1a10.dev427', 'gwpy-plot')
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 534, in run_script
    dist = self.by_key.get(req.key)
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 1434, in run_script
    def _listdir(self,fspath):
  File "/mnt/qfs4/duncan.macleod/.local/lib/python2.6/site-packages/gwpy-0.1a10.dev427-py2.6.egg/EGG-INFO/scripts/gwpy-plot", line 118, in <module>
    result_code = prod.makePlot(args)
  File "/home/duncan.macleod/.local/lib/python2.6/site-packages/gwpy-0.1a10.dev427-py2.6.egg/gwpy/cli/cliproduct.py", line 777, in makePlot
    self.annotate_save_plot(args)
  File "/home/duncan.macleod/.local/lib/python2.6/site-packages/gwpy-0.1a10.dev427-py2.6.egg/gwpy/cli/cliproduct.py", line 650, in annotate_save_plot
    self.ax.legend_.remove()
  File "/home/duncan.macleod/.local/lib/python2.6/site-packages/matplotlib/artist.py", line 137, in remove
    raise NotImplementedError('cannot remove artist')
NotImplementedError: cannot remove artist

This has been confirmed with matplotlib 1.3.1, and confirmed as not a bug with matplotlib 1.4.2.