Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing Line2D is broken #4966

Closed
WeatherGod opened this issue Aug 20, 2015 · 1 comment · Fixed by #4969
Closed

Removing Line2D is broken #4966

WeatherGod opened this issue Aug 20, 2015 · 1 comment · Fixed by #4969
Assignees
Milestone

Comments

@WeatherGod
Copy link
Member

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.

@tacaswell
Copy link
Member

I am on this one.

@tacaswell tacaswell self-assigned this Aug 20, 2015
@tacaswell tacaswell added this to the next point release milestone Aug 20, 2015
tacaswell added a commit to tacaswell/matplotlib that referenced this issue Aug 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants