Skip to content

Removing Line2D is broken #4966

Closed
Closed
@WeatherGod

Description

@WeatherGod

I have been trying out all of my code examples from my book against master to find any additional bugs. I came across this one in chapter 2 where I set up an example for selecting and removing Line2D objects from a plot. Doing so now causes this traceback:

ben@tigger:~/Documents/InteractiveMPL$ python chp2/track_deleter.py 
Traceback (most recent call last):
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_qt5.py", line 314, in keyPressEvent
    FigureCanvasBase.key_press_event(self, key, guiEvent=event)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 1846, in key_press_event
    self.callbacks.process(s, event)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 562, in process
    proxy(*args, **kwargs)
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 429, in __call__
    return mtd(*args, **kwargs)
  File "chp2/track_deleter.py", line 32, in keypress
    self.selected.remove()
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 159, in remove
    self.axes = None
  File "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/lines.py", line 572, in axes
    if ax.xaxis is not None:
AttributeError: 'NoneType' object has no attribute 'xaxis'

Essentially, calling Line2D.axes = None as part of the remove process is triggering its property setter, and that property setter is assuming that an Axes object is always passed in.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions