Skip to content

[MNT]: pyplot.xkcd() leads to findfont errors under Windows  #27350

Open
@bkasel

Description

@bkasel

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 the xkcd function, to get rid of the errors

    rcParams.update({
        'font.font-family': ['xkcd', 'xkcd Script', 'Comic Neue', 'Comic Sans MS'],
...

to

   rcParams.update({
       'font.sans-serif': ['xkcd', 'xkcd Script', 'Comic Neue', 'Comic Sans MS'],
...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions