I recently created a PR (#20627) related to the alignment problem. (I don't think it fixes this issue, though, so it merits further analysis.) It went through a lot of trial and error, but I think I got the alignment to look reasonable (see #20627 (comment)).
It seems like the distance is also scaled with the height of the bar.
Yes, this is intentional. The space is a multiple of the height, as mentioned in the TeX book linked in #18389 (comment).
Ah, OK! Looks like solid work! How does your PR behave with a larger rule? It didn't look like it scaled with rule in the code, but maybe that is handled some other way?
Edit: I now noted that you shifted based on rule, so probably is OK then.
But would be interesting to see the result with like rule=10.
I just took a look; that PR doesn't work with your example code! In theory, the fix should be simple …
The clearance was being calculated using the thickness of a standard underline (that's the current behaviour, as well as the behaviour in the mentioned PR). All we need to do is use the thickness of the rule which is drawn.
Here's the result with the said change.
But what do we do if the rule is absent (i.e. is of zero thickness)? Things like \binom may break. (ETA This is covered in section 745 of the TeX book.)
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
Activity
tfpf commented on Jan 9, 2022
I recently created a PR (#20627) related to the alignment problem. (I don't think it fixes this issue, though, so it merits further analysis.) It went through a lot of trial and error, but I think I got the alignment to look reasonable (see #20627 (comment)).
Yes, this is intentional. The space is a multiple of the height, as mentioned in the TeX book linked in #18389 (comment).
oscargus commented on Jan 9, 2022
Ah, OK! Looks like solid work! How does your PR behave with a larger rule? It didn't look like it scaled with rule in the code, but maybe that is handled some other way?
Edit: I now noted that you shifted based on rule, so probably is OK then.
But would be interesting to see the result with like rule=10.
tfpf commented on Jan 9, 2022
I just took a look; that PR doesn't work with your example code! In theory, the fix should be simple …
The clearance was being calculated using the thickness of a standard underline (that's the current behaviour, as well as the behaviour in the mentioned PR). All we need to do is use the thickness of the rule which is drawn.
Here's the result with the said change.

But what do we do if the rule is absent (i.e. is of zero thickness)? Things like \binom may break. (ETA This is covered in section 745 of the TeX book.)
May need to dive into the TeX book again.
github-actions commented on Nov 17, 2025
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
QuLogic commented on Apr 10, 2026
The text-overhaul branch is now merged to main.