-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
[Bug]: Numbers in words not italic #29253
Comments
|
The seemingly correct way to do that is to instead write
However, if this works or not will depend on if the font you are using, determined by It may be that there is a bug here, but I have not really figured out if it depends on the font or if, for some reasons, digits are not rendered using the italic font, as the default font is not rendered correctly. |
Hello, can I work on this if this really is a bug? |
I already tried this |
Why are you using mathtext? |
Is it possible to mix italic and upright fonts in a single label otherwise? |
What else should I use except mathtext?
I tried to mix fonts but it didn’t work.
…On Sun 8. Dec 2024 at 12:38, Oscar Gustafsson ***@***.***> wrote:
Why are you using mathtext?
Is it possible to mix italic and upright fonts in a single label otherwise?
—
Reply to this email directly, view it on GitHub
<#29253 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2U6NWQVL6DHSRA4L4MUCU32EQVSJAVCNFSM6AAAAABTGHTJT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRVGY3TKNBVHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
It does seem like we aren't consistent with Latex here. If I do ax.set_ylabel(r'$\it{abc123}$', usetex=False) only the letters are in italics, whereas if I do ax.set_ylabel(r'$\it{abc123}$', usetex=True) both letters and numbers are in italics. @Sanas-m the first example above uses Matplotlib's mathtex whereas the second example (usetex=True) uses my locally installed Latex. This may be a workaround for you and you can set an rcParam to turn it on for all your text: |
Sorry, agree you need something tex-like if you want to mix italic and non-italics. |
This looks like a bug to me (matching tex's behavior seems reasonable). The code that forces numbers to be in roman is under |
I tried this but then the fonts are mixed again |
Bug summary
Y labels in plots cannot be displayed in italic if the label contains numbers. While the letters will be italic, the numbers will stay in normal font.
Code for reproduction
Actual outcome
Expected outcome
Additional information
No response
Operating system
Mac OS Apple M1 Ventura 13.4.1
Matplotlib Version
3.9.2
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
3.11.3
Jupyter version
6.5.4
Installation
pip
The text was updated successfully, but these errors were encountered: