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

BUG? subplot with sharex clears axes #2859

Closed
jluttine opened this issue Mar 3, 2014 · 2 comments
Closed

BUG? subplot with sharex clears axes #2859

jluttine opened this issue Mar 3, 2014 · 2 comments

Comments

@jluttine
Copy link

jluttine commented Mar 3, 2014

I found that providing the sharex keyword argument to subplot clears previously drawn lines from the axes:

import matplotlib.pyplot as plt
plt.figure()
ax = plt.subplot(2,1,1)
plt.subplot(2,1,2)
plt.plot([1,2,3])

# why the following clears the plotted line???
plt.subplot(2,1,2, sharex=ax)

I suppose it is a bug?

@NelleV
Copy link
Member

NelleV commented Mar 3, 2014

You are creating a new axes object on top of the previous one. This isn't a bug.

@jluttine
Copy link
Author

jluttine commented Mar 3, 2014

Ok, so if I call subplot with a different sharex value than before, it will create a new axes object. (?) Good to know, I did not notice this info in the docs. Thanks!

@jluttine jluttine closed this as completed Mar 3, 2014
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