Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Labels
Description
Bug summary
When the last item in a MathtextVlist
is anHrule
, the AGG and SVG backends render the image differently. The difference is not obvious at small font sizes.
To see this happen, we have to dive into Mathtext internals. An easy way is to modify fractions to end with the horizontal rule.
Code for reproduction
importmatplotlib.pyplotaspltimportmatplotlib._mathtextas_mathtextplt.rcdefaults()def_genfrac(self,ldelim,rdelim,rule,style,num,den):state=self.get_state()thickness=state.get_current_underline_thickness()vlist=_mathtext.Vlist([num,_mathtext.Vbox(0,2*thickness),_mathtext.Hrule(state,thickness)])return [_mathtext.Hlist([vlist])]_mathtext.Parser._genfrac=_genfrac(fig,ax)=plt.subplots()plt.text(.5,.3,r'$\dfrac{up}{down}$',size=100,ha='center',va='baseline')plt.axhline(.3)plt.savefig('Hrule_at_bottom.png')plt.savefig('Hrule_at_bottom.svg')plt.show()
Actual outcome
Expected outcome
Both images should be identical.
Additional information
Why does it matter if it's related to a private module in Matplotlib?
This is one of the things holding up#23616.Vlist
s ending with anHrule
are not being positioned correctly.
Operating system
Ubuntu 20.04 LTS Focal Fossa on WSL
Matplotlib Version
3.5.0.dev5855+gee2f68bdc9
Matplotlib Backend
WXAgg
Python version
Python 3.8.10
Jupyter version
6.0.3
Installation
git checkout