-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Removing axes created by twiny() leads to an error #18925
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
Comments
The fix here is to sort out why #14997 only worked on the x-axis and not the y-axis... |
From a quick look, I think that's unrelated to #14997 and actually due to the fact that the _shared_x_axes/_shared_y_axes/_twinned_axes groupers don't get updated when an axes is removed, and then the removed axes show up when _update_title_position calls _twinned_axes.get_siblings. (And the this only affects twiny because of implementation details of XAxis.get_tick_space.) Likely Figure.delaxes also needs to update the groupers, but note that on top of that add_axes (which explicitly can re-add a previously removed axes) should also update the groupers back if such an axes is readded. |
I still have this problem, if there is not a fix, is there possibly a known work-around? |
Bug report
Bug summary
Removing axes created with twiny() leads to an error. I have found a very similar bug to my issue here: #14911. Interestingly enough this works with twinx(). The code in the original bug report also works in my installation.
Code for reproduction
Actual outcome
Expected outcome
A plot with the twiny axes removed
Matplotlib version
print(matplotlib.get_backend())
): TkAggPython is from miniconda, all packages installed via pip.
The text was updated successfully, but these errors were encountered: