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]: \mathcal does not work when font.weight is "bold" #22056
/home/novak/.virtualenvs/statistics/lib/python3.6/site-packages/matplotlib/mathtext.py:849: MathTextWarning: Font 'nonuniit' does not have a glyph for 'A' [U+e22d]
MathTextWarning)
/home/novak/.virtualenvs/statistics/lib/python3.6/site-packages/matplotlib/mathtext.py:850: MathTextWarning: Substituting with a dummy symbol.
warn("Substituting with a dummy symbol.", MathTextWarning)
Expected outcome
I get that LaTex may not do \mathcal in bold, but I'd expect Matplotlib to ignore the "bold" directive when plotting the legend.
However, I'm not sure how tricky would that be for implementation.
If I understand it correctly, this is used if the "normal" rendering doesn't work. Here, the best match is used, should be bf, but as there are no bf-fonts defined, this is used as a backup and e22d is returned for A.
So one answer may be that you do not have a Stix font installed. Another that there are no bold mathcal defined. A third that there is an incorrect matching even if you had one defined (and non-bold).
As a side point, I find it rather surprising that mathtext respects rcParams["font.weight"] at all (how is that even supposed to interact with rcParams["mathtext.default"]?) Looking at the implementation I'm not sure whether this was intended or accidental...
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
jklymak commentedon Dec 27, 2021
That is a pretty old matplotlib. Can you try a more recent version and see if the problem persists?
dstansby commentedon Dec 27, 2021
I can reproduce this on an up to date checkout of
main.oscargus commentedon Jan 8, 2022
This is a bit confusing.
e22dcomes frommatplotlib/lib/matplotlib/_mathtext_data.py
Line 1286 in 5de27aa
If I understand it correctly, this is used if the "normal" rendering doesn't work. Here, the best match is used, should be
bf, but as there are nobf-fonts defined, this is used as a backup ande22dis returned forA.However,
e22dis not a standard Unicode position, but a Stix extended position. Which according to http://www.ams.org/STIX/private/stixprv-E2.html isright harpoon-down over left harpoon-down.So one answer may be that you do not have a Stix font installed. Another that there are no bold mathcal defined. A third that there is an incorrect matching even if you had one defined (and non-bold).
oscargus commentedon Jan 8, 2022
Maybe the analysis was not 100% correct, but if you install https://github.com/stipub/stixfonts/ and set
plt.rcParams['mathtext.fontset'] = 'stix'you will at least not get an error. Then, it looks like there are no bold mathcal-font available in there (or at least does matplotlib not point them out).A problem here is most likely that matplotlib tries to use the stix-font mapping although stix is not installed.
anntzer commentedon Jan 17, 2022
As a side point, I find it rather surprising that mathtext respects rcParams["font.weight"] at all (how is that even supposed to interact with rcParams["mathtext.default"]?) Looking at the implementation I'm not sure whether this was intended or accidental...
github-actions commentedon Nov 19, 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!