-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
'mathtext.fontset' is only available as an rcParam, should be carried along with text object #7107
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
Comments
@FaustinCarter Thank you for the very clear explanation of the problem. Related to #7005 as it relates to when rcParams are bound to an artist (at creation time or draw time). |
@tacaswell Thanks for the quick reply. Looking forward to the new release! |
This is not as easy as I thought it would be. The instance of attn @mdboom |
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
Closed by #18145. |
Matplotlib version 1.5.1
Installed via Anaconda
Issue: When formatting labels (or any text object), one may specify a
fontdict
dictionary of options. Thisfontdict
supersedes the rcParams and ensures that the text object is always rendered correctly. However, if the text object includes math between dollar signs (i.e.'$a=5$'
) and thematplotlib.mathtext.Parser
is used to render the math, the font-face for the rendered math is specifiable only in the rcParams. This makes it impossible to specify an explicit font face for math within a text object, as whenever that object renders, the math font will always be set by the'mathtext.fontset'
rcParam. This is especially problematic when using matplotlib in interactive mode (i.e. IPython), as every time the text object is rendered, the math font face will change appearance based on the current rcParam value, but all of the other font attributes will continue to be set by the associatedfontdict
.This may not seem like a big deal, but imagine a developer releases a function to a user that returns a figure object with math in the labels. The developer has chosen to use a sans-serif face for the math, and so changes the rcParams (as this is currently the only handle). Now any future plots the user generates during that interactive session (or in the same script) will silently use the modified rcParam, rather than the users' chosen default, contrary to expectations.
Suggested fix: add a
mathdict
arg to text objects, which would be analogous to thefontdict
arg, but for all the mathtext rcParams, and pass that to the mathtext parser.The text was updated successfully, but these errors were encountered: