Skip to content

fontset from mathtext throwing error after setting Text font= #20099

Description

@diegopetrola

Bug report

This issue was initially reported by the user @ain-soph at the PR #18145. I was able to reproduce the error with the provided code and decided to formalize the issue here while I work on it.

Code for reproduction:

import matplotlib.pyplot as plt
import matplotlib

plt.figure(figsize=(6, 5))
plt.plot(range(11), color="0.9")
msg = (r"Normal Text. $Text\ in\ math\ mode:\ "
       r"\int_{0}^{\infty } x^2 dx$")
plt.text(1, 7, msg, size=12, font='Arial')  # math_fontfamily='cm'
plt.show()

And the outcome is:

....
 File "c:\repos\matplotlib\matplotlib\lib\matplotlib\mathtext.py", line 431, in _parse_cached
    else _api.check_getitem(
  File "c:\repos\matplotlib\matplotlib\lib\matplotlib\_api\__init__.py", line 187, in check_getitem
    raise ValueError(
ValueError: None is not a valid value for fontset; supported values are 'cm', 'dejavuserif', 'dejavusans', 'stix', 'stixsans', 'custom'

Matplotlib version: 3.4.1.post563+g679ca172e.d20210428

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions