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_mosaic bug with empty_sentinel and sharey=True #25417
Comments
|
This comes from matplotlib/lib/matplotlib/axes/_base.py Line 4533 in 75a35e0
as The subplotspec is not enough to determine this, but one will have to look at the GridSpec instead. However, I am not sure that the GridSpec has access to the original subplot_mosaic information. A similar issue is seen if you drop the |
|
This is a feature request rather than a bug per-se. We don't have any mechanism for deciding post facto if a general axes has any axes to its left or below. |
|
But the ylabel (or xlabel) is assigned correctly. Could the axis label share the same mechanism for assigning axes ticks? (just throwing out the thought... I hope it helps). Thanks for looking into it. |
|
You set the ylabel on the |
|
Just to be clear, just as you manually set the ylabel for "A" you can also change the tick params to show the tick labels manually: |
|
I am going to label this as "medium difficulty" as it will require reading and understanding some esoteric part of the code base and developing a robust way to detect the "outer most Axes", but "good first issue" as there is no public API design and should be easy to test (both the dense case and the sparse case). This has come up a number of times (but I have failed to find the linked issue, I know at BNL we have some special logic to put the labels on the second to last row if the bottom row is not visible...slightly easier case because we know it is the dense case and we are the ones making some of the bottom row invisible) so there is definitely a desire for this sort of functionality and a user expectation that "remove all but outer" should mean "outer most visible Axes". I think @oscargus correctly identified that any of this logic should go in |
|
Removed good first issue as there is not consensus we want this ;) I think the issue with CL is there independent of how automatic we make the removal. Maybe the best option is this case is to turn on all of the tick labels and still only remove them on the outer most rows / columns? |
|
It is quite easy to come up with weird cases where it is not obvious what the "correct" solution looks like when it comes to labeling, e.g. So maybe the solution is to discuss this a bit in the documentation and in an example? |
|
"sharex/y" means two things: link the axes limits, so interactive use makes the axes track one another. Additionally for grids this has meant removing inner tick labels I personally consider it bad API that we do both with the same kwarg, but that ship sailed many years ago. I personally feel that for any special layouts (empty axes), we should just let people choose to label or not by hand. |
|
ok, I am convinced this is not a change we want to make. I think the action here is to add an example? |




Bug summary
When an empty sentinel is used at the beginning of a row, with the sharey option True, the tick labelling on the y-axis isn't shown.
Code for reproduction
Actual outcome
mosaic_working.pdf
mosaic_not_working.pdf
Expected outcome
The y-axis in the first subplot of the top row should have y ticks.
Additional information
No response
Operating system
OS
Matplotlib Version
3.7.0
Matplotlib Backend
No response
Python version
3.11
Jupyter version
No response
Installation
pip
The text was updated successfully, but these errors were encountered: