Open
Description
Bug summary
When including LaTeX with a superscript, the bbox is computed incorrectly.
Code for reproduction
import matplotlib.pyplot as plt
kw = dict(
usetex=True,
fontsize=40,
bbox=dict(boxstyle='round,pad=0', fc='lightsteelblue', ec='none')
)
plt.axhline(y=0.7)
plt.annotate('A', xy=(0.3, 0.7), **kw)
plt.annotate(r'$A$', xy=(0.4, 0.7), **kw)
plt.annotate(r'$^{\tiny 1}A$', xy=(0.5, 0.7), **kw)
plt.annotate(r'$^{\tiny 1j}A$', xy=(0.65, 0.7), **kw)
plt.axhline(y=0.4)
plt.annotate('A', xy=(0.3, 0.4), va='bottom', **kw)
plt.annotate(r'$A$', xy=(0.4, 0.4), va='bottom', **kw)
plt.annotate(r'$^{1}A$', xy=(0.5, 0.4), va='bottom', **kw)
plt.annotate(r'$^{1j}A$', xy=(0.65, 0.4), va='bottom', **kw)
plt.show()
Actual outcome
Expected outcome
The bounding box should correctly surround the superscript.
Additional information
Operating system
Ubuntu
Matplotlib Version
3.5.0
Matplotlib Backend
No response
Python version
3.8.10
Jupyter version
No response
Installation
pip