Bug summary
With this in matplotlibrc:
font.sans-serif : Ubuntu
font.size : 10.0
font.weight: 300
mathtext.default : regular
I expect all text (math and regular) to be rendered with the "Ubuntu" font at a size of 10.0 and a weight of 300. This is what happens. However, when I use math text, I get this warning multiple times:
findfont: Failed to find font weight 300, now using 400.
It seems that the math text rendering machinery looks up the glyphs for the math text in a different font before looking them up in the desired font.
It would be great if the warning could specify which font is being looked up.
Code for reproduction
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams.update({
'font.sans-serif': 'Ubuntu',
'font.size': 10.0,
'font.weight': 300,
'mathtext.default': 'regular',
})
plt.figure()
plt.text(0.1, 0.5, 'Foo')
plt.text(0.2, 0.5, 'Foo $x$')
plt.show()
Actual outcome
$ python mathtext.py
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
findfont: Failed to find font weight 300, now using 400.
Expected outcome
No warnings.
Additional information
No response
Operating system
Windows 11
Matplotlib Version
3.11.0
Matplotlib Backend
qtagg
Python version
3.14.6
Jupyter version
No response
Installation
pixi
Bug summary
With this in
matplotlibrc:I expect all text (math and regular) to be rendered with the "Ubuntu" font at a size of 10.0 and a weight of 300. This is what happens. However, when I use math text, I get this warning multiple times:
It seems that the math text rendering machinery looks up the glyphs for the math text in a different font before looking them up in the desired font.
It would be great if the warning could specify which font is being looked up.
Code for reproduction
Actual outcome
Expected outcome
No warnings.
Additional information
No response
Operating system
Windows 11
Matplotlib Version
3.11.0
Matplotlib Backend
qtagg
Python version
3.14.6
Jupyter version
No response
Installation
pixi