-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: latex font doesn't apply to formatted ticks #26179
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
The problem is that setting the font to sans-serif, will not set the math-font to sans-serif. See https://stackoverflow.com/questions/2537868/sans-serif-math-with-latex-in-matplotlib for solutions. As To get around this, you can use the |
I appreciate you looking into this. I understand math text needs to be set separately, the problem I've been having is mathtext.fontset doesn't work at all so I was trying to figure out a way to turn the math text into a string in order to keep any previously set formatter (which both my and your solution's don't do since formatstrformatter can remove exponents/symbols from the previously set formatter). |
the Ref: https://matplotlib.org/stable/users/prev_whats_new/dflt_style_changes.html#math-text |
If your usage is supported by mathtext (without calling out to full LaTeX), then that may solve your immediate issue. otherwise it will likely mean some combination of |
I see, that makes sense. Thank you both for your help, I really appreciate it. Taking mathtext and turning it into a string so the font applies is probably not possible with exponents/symbols as well. I'm guessing this is more of a feature request to allow mathtext font changes when latex is set to True then, should I close this and make that request? |
Bug summary
When latex is turned on and tick format uses specific formatters (i.e logformattermathtext, scalarformatter with scientific tuned on), the font doesn't apply and switches back to serif.
Code for reproduction
Actual outcome
Expected outcome
The yticks should match the xtick/labels font (sans-serif) even though the formatting is different.
Additional information
No response
Operating system
Linux
Matplotlib Version
3.5
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
pip
The text was updated successfully, but these errors were encountered: