-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add ability to unshare a pair of shared [xy] axes #1312
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
Conversation
I should also say that this is my attempt at resolving #318. |
These seems to be too zealous in its disconnection. Consider this (based on
The Admittedly, this is a problem with the Think of it this way: suppose you have the graph where A is connected to B and B is connected to C:
The grouper builds a single set "ABC" but throws away the source edges entirely. So then if you later want to remove the edge BC, it doesn't know whether A was connected to B or C in the first place, so it can't know that the resulting subset should be "AB". So it looks like we may want to reimplement Sorry to have sent you on a wild goose chase about adding |
I see, the I'd still like to implement this feature, but I think -- as you mentioned -- it's necessary to re-implement either As an initial idea, how about each Using your The Then a call to The The resulting schematic would be:
Thoughts? |
That seems reasonable. One would then need a function to do depth search on the graph to find all of a shared axes siblings when then axes are updated -- but that should probably work fine. One care that must be taken is when sharing axes between figures -- in this approach, a shared axes has the potential to keep another figure alive and non-deletable. The current approach uses weak references to avoid that. |
Fair, and a depth-first search is not going to be slow here. How many axes does one typically share? Maybe, at worst, 10? I think the weak reference approach should still be fine. The only thing that has changed is the ability to see the sharing relationships between axes. Edit: grammar. |
What is the status of this PR? Does it need some work before it can be merged? If so, I suggest we close this until it is ready for consideration. Cheers, |
This appears to no longer be overzealous in the unsharing. I'm not sure this implementation is the best. I'm also unsure of the consequences on storing a list of Is someone willing to play with this and give some feedback? |
@mdboom Would you mind playing with this today? (sprinty mcsprintington) |
@dmcdougall, @ivanov and I just had a meat-space discussion about this. We came down to this: should unsharing work as an inverse operation to sharing, or should it work to orphan a single node? Imagine this: you start with:
then you join C and D
with the implementation in this PR, it is possible to undo that operation with However, one could conceive of this:
In this case, saying Perhaps we need to get back to the original use case that motivated this to decide the best way forward. |
Definitely. Personally I've never seen a need for this functionality, but my mind is open to a sensible use case... |
I think one use case is building applications which have mpl embedded and wanting the ability to add/remove overlays where twin[x,y] is the right way to do it. |
@tacaswell : I suspect in that case, my first example above is the appropriate one, and this PR implements it. @dmcdougall: Do you want to have the honours of rebasing this and adding a test or two? |
There's a slight problem with this implementation -- sharing is now no longer transitive. Transitive sharing is the behaviour of the current implementation, using Regarding the unsharing vs. orphaning discussion, there's no reason we can't have both. |
any news on this issue? Is there in the meantime some way of linking existing axes or unsharing? |
@a6073758 Thanks for expressing interest in this. Is this feature something you need? If so, would you mind saying a few words about a use-case you have in mind for it? I'd like to better understand how it will be used. A decision needs to be made regarding what 'unsharing' should actually do. And it should be done so that the current sharing behaviour remains unchanged. The interface @mdboom suggested seems very reasonable, with |
I'd like to probe this unsharing concept a bit. I could imagine it might On Thu, Jul 31, 2014 at 6:29 AM, Damon McDougall notifications@github.com
|
Closing as it looks like moving away from |
Guess no progress on this. Since sharing is symmetric and transitive in nature. An unlink operation should simple orphan the node. |
Example:
I've tried this simple case out, and it seems to work quite nicely. I had to add functionality to remove weak references from
cbook.Grouper()
and that change is included in this pull request.