Skip to content

[ENH]: Axes.get_shared_x_axes() returning mutable Grouper #27161

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

Closed
raamana opened this issue Oct 20, 2023 · 2 comments
Closed

[ENH]: Axes.get_shared_x_axes() returning mutable Grouper #27161

raamana opened this issue Oct 20, 2023 · 2 comments

Comments

@raamana
Copy link
Contributor

raamana commented Oct 20, 2023

Problem

I tried to post this on discourse, but that forum is too restrictive in flagging my question as spam (just because I am linking to the specific lines of code to provide context).. so here goes:

it used to be that Axes.get_shared_x_axes() returned a cbook.Grouper() which had a .join() method, but now it is returning an cbook.GrouperView() that is IMMUTABLE. It is breaking my tool and I don't even understand the rationale for such backward incompatible change.

regardless, I need a workaround that would continue to work with future versions of matplotlib. Much appreciate your help in pointing me to the right methods and properties to achieve the same effect as this.

thanks very much.

Proposed solution

revert to the previous behaviour of Axes.get_shared_x_axes() returning a mutable Grouper

@raamana raamana changed the title [ENH]: [ENH]: Axes.get_shared_x_axes() returning mutable Grouper Oct 20, 2023
@jklymak
Copy link
Member

jklymak commented Oct 21, 2023

@ksunden
Copy link
Member

ksunden commented Oct 21, 2023

This was deprecated in 3.6.0 in #21584 and should have been warning for several releases now.

https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.6.0.html#groupers-from-get-shared-x-axes-get-shared-y-axes-will-be-immutable

Calling sharex is the expected api for doing this task, and additionally makes sure that the axes are consistent when sharing is started (though fundementally it is doing the same thing to the underlying Grouper object).

@ksunden ksunden closed this as completed Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants