-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MNT]: pyplot.xkcd() leads to findfont errors under Windows #27350
Comments
I'd assume this would be due to #27339 but the only change there was removing humor sans. |
I think this is older than that; the caching on the warning seems either very specific, or non-existent, as it seems to trigger at all draws (e.g., pan or resize, and a bunch of warnings are printed.) |
That's what I thought was going on w/ the findfont warning - is why I started #26602 Also I don't know if it's a windows specific thing, but I think I have to delete my fontcache to force a rebuild. |
These warnings are caused by This function searches the complete list of matplotlib/lib/matplotlib/font_manager.py Line 1351 in 0a4efbe
implicitly assuming that all entries are family names. If this list also contains concrete font names, a warning will be issued if a font name is not found. Prior to v3.6.0, only the existing font files from the font cache were reviewed in See the following example:
Starting with v3.6.0 it returns the warnings So to fix this concrete issue it would indeed be sufficient to set |
My preference would be to allow font-names as part of finding family names (or control w/ a flag that defaults to permissive), what am I missing for why that's a bad idea? |
I didn't say that
|
I think I'm the one who phrased things weird, I was just asking if we could expand find font family to not raise a warning if the font exists |
I guess it should read "if the font doesn't exist". If the font exists then |
Probably - what I'm getting at is basically that when it comes to not found error messages, we should be assuming something like this relation for the rcparams: so that if updating |
Summary
any plot with the xkcd style
pyplot.xkcd()
generates a bunch of errors from the findfont function under Windows even when fonts like "Comic Neue" are installed. I also regenerated the font cache and copied the font files into the matplotlib site-packages font folder, but this did not help. (I am using mpl 3.8.2 on python 3.11)I am unsure if this is an issue under other OSs but I have the same issue under Win10 and Win11
Proposed fix
In the end I modified the
pyplot.py
file in thexkcd
function, to get rid of the errorsto
The text was updated successfully, but these errors were encountered: