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

AttributeError: 'NoneType' object has no attribute 'canvas' #5663

Closed
dessant opened this issue Dec 11, 2015 · 1 comment
Closed

AttributeError: 'NoneType' object has no attribute 'canvas' #5663

dessant opened this issue Dec 11, 2015 · 1 comment
Assignees
Milestone

Comments

@dessant
Copy link

dessant commented Dec 11, 2015

Removing an ax created with twinx/twiny and then adding a new one with a plot, or just setting xlim/ylim for it triggers the crash (twinx -> xlim, twiny -> ylim).

import matplotlib
matplotlib.use('TkAgg')  # same with 'agg'

import matplotlib.pyplot as plt

fig = plt.figure()
ax1 = fig.add_subplot(111)

ax2 = ax1.twinx()
ax2.remove()

ax3 = fig.add_subplot(111)
ax3.set_xlim([1, 5])

plt.show()
Traceback (most recent call last):
  File "E:\dev\prs\main\test2.py", line 13, in <module>
    ax3.set_xlim([1, 5])
  File "e:\dev\envs\py34_x86\Python\lib\site-packages\matplotlib\axes\_base.py", line 2783, in set_xlim
    other.figure.canvas is not None):
AttributeError: 'NoneType' object has no attribute 'canvas'
@tacaswell tacaswell added this to the next bug fix release (2.0.1) milestone Dec 13, 2015
@tacaswell
Copy link
Member

Apparently the remove is not doing enough clean up

Also note that ax1 is ax3 == True.

@tacaswell tacaswell modified the milestones: Critical bugfix release (1.5.1), next bug fix release (2.0.1) Dec 13, 2015
@tacaswell tacaswell self-assigned this Dec 15, 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

No branches or pull requests

2 participants