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

Explicitely passing an axes to share axis with #1732

Closed
wants to merge 2 commits into from

Conversation

FabricioS
Copy link

See issue #1731

@@ -910,6 +914,8 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
# same as
plt.subplots(2, 2, sharex=True, sharey=True)
"""
if subplot_kw is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the most desirable approach. Is is not possible to fix this at the source of the problem (i.e. the change that occurred between 1.1 and 1.2?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is puzzling you exactly ? As mentioned in #1731 the commit introduce a new feature that was as a matter of fact not handled in 1.1. It avoids the redondant use of sharex as a keyword argument and in subplot_kw.

@efiring
Copy link
Member

efiring commented Feb 17, 2013

I'm concerned that sharing axes across figures could cause trouble. What happens if the user closes the figure with the specified Axes? Does that cause the figure with the subplot sharing that Axes to crash when redrawn?

@tacaswell
Copy link
Member

My understanding of how this worked was that the second axes has a ref to the axis bits and pieces of the first one, so even if you close the first figure, the axis object is not garbage collected.

Experimentally

import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = fig.add_subplot(111)
fig2 = plt.figure()
ax2 = fig2.add_subplot(111, sharex=ax1)

seems to work fine after closing the first figure.

@pelson
Copy link
Member

pelson commented Apr 18, 2013

I think we need a test for this PR and then it gets my 👍.

@pelson
Copy link
Member

pelson commented May 13, 2013

@FabricioS - are you willing to add a test - and then we're good to go.

@mdboom
Copy link
Member

mdboom commented May 28, 2013

@FabricioS: Today is the day we're (hopefully) tagging 1.3.0, so we'll need a test for this PR in order for it to make the cut.

@FabricioS
Copy link
Author

Sorry for not answering earlier... What kind of test are you expecting ? Extending test_shared in matplotlib / lib / matplotlib / tests / test_subplots.py ?

@tacaswell
Copy link
Member

@FabricioS You still interested in working on this?

I would check that axis objects are the same object in the created axes and the one you passed in.

@pelson
Copy link
Member

pelson commented Dec 3, 2013

@FabricioS - I'm going to go ahead and close this PR. It is not to say I wouldn't be comfortable merging this once it has a test, but the number of lingering mpl PRs makes seeing the wood from the trees a little difficult.

Please feel free to re-open once a simple test case exists.

All the best,

@pelson pelson closed this Dec 3, 2013
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 this pull request may close these issues.

5 participants