You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: title position incorrect for polar plot #29381
When using a polar coordinate system the plot title overlaps with the axis labels. This worked in 3.9.4 and broke with 3.10.0. This commit broke it: 8abe308 via #28300
This bug happens with the new 3.10 version, but with the 3.9.4 version
I performed a git bisect using this:
git bisect start
git bisect good v3.9.4
git bisect bad HEAD
a small test script check.py - there's probably a better way, but that's what I came up with. (Note that the issues also comes up when not using `bbox_inches='tight', but this way it was easier to bisect, since I could instrument the image size)
Without having tested in code, I suspect that prior to #28300, l.3006
if (ax.xaxis.get_ticks_position() in ['top', 'unknown']
the “unknown” has likely caught the polar tick.
That has been cut out by a visible check on all tick.label2, an assumption that is correct only for rectangular axes, where label2 corresponds to the top labels of the x axis.
Well I'm glad I left good notes because otherwise what I did would be a mystery to me 😅. From #26150 (comment) Past Me thought another good option would be to return an extra option from get_ticks_position. For the target case, neither top nor bottom ticks were visible due to axis sharing, so it seems sensible to me that get_ticks_position could return "neither" or "none" rather than "unknown" for that case.
Thanks @jkittner for the clear report and for doing the bisect.
Why "other"? That seems no more specific than "unknown". For the sharex case we know that neither top nor bottom ticks are visible, so we can explicitly check for that case which is not currently considered by get_ticks_position.
Sorry, maybe out of context because I’m writing from a phone and may have overlooked something.
My thought was that polar ticks are nether “top” nor “bottom” not “unknown”, but in another arrangement.
Ah OK, we could do both "neither" for the sharex case and "other" for the polar case - though I'm not sure how best to detect the polar situation. In any case I propose to leave that question for v3.11 and just partially revert #28300 to fix the bug for v3.10.1 (see #29382).
Activity
timhoffm commentedon Dec 27, 2024
Without having tested in code, I suspect that prior to #28300, l.3006
the “unknown” has likely caught the polar tick.
That has been cut out by a visible check on all tick.label2, an assumption that is correct only for rectangular axes, where label2 corresponds to the top labels of the x axis.
rcomer commentedon Dec 27, 2024
Well I'm glad I left good notes because otherwise what I did would be a mystery to me 😅. From #26150 (comment) Past Me thought another good option would be to return an extra option from
get_ticks_position. For the target case, neither top nor bottom ticks were visible due to axis sharing, so it seems sensible to me thatget_ticks_positioncould return "neither" or "none" rather than "unknown" for that case.Thanks @jkittner for the clear report and for doing the bisect.
timhoffm commentedon Dec 27, 2024
Or “other”?
rcomer commentedon Dec 27, 2024
Why "other"? That seems no more specific than "unknown". For the sharex case we know that neither top nor bottom ticks are visible, so we can explicitly check for that case which is not currently considered by
get_ticks_position.timhoffm commentedon Dec 27, 2024
Sorry, maybe out of context because I’m writing from a phone and may have overlooked something.
My thought was that polar ticks are nether “top” nor “bottom” not “unknown”, but in another arrangement.
rcomer commentedon Dec 27, 2024
Ah OK, we could do both "neither" for the sharex case and "other" for the polar case - though I'm not sure how best to detect the polar situation. In any case I propose to leave that question for v3.11 and just partially revert #28300 to fix the bug for v3.10.1 (see #29382).
Fix matplotlib#29381: Add get_title_top() method for custom title pos…
Fix matplotlib#29381: Add get_title_top() method for custom title pos…
Fix matplotlib#29381: Update title positioning implementation