PyPlot - Axis label, italic format for the symbol only

Dear all, in PyPlot, do you know how to format the symbol to italic only, the other words should be normal.
For example: x label “Grading index IG”. Then I would like IG to be italic.

This should work:

xlabel = "grading index \$I_G\$"

I use Pyplot through Plots.jl so an MWE would be:

using Plots; pyplot()
plot(rand(100), xlabel = "grading index \$I_G\$"

Thank you very much! It worked perfectly

Excuse me, do you know any way to keep the same font of the italic symbol, as the other?
In this case, do you how to we keep the same Times New Roman font?

It depends a bit on which fonts PyPlot can access, but generally the way to change it would be

plot(rand(100), xlabel = "grading index \$I_G\$", guidefont=font("serif"))
1 Like

In Julia, the command is like this:

plot(rand(100)); xlabel( "grading index \$I_G\$", fontname="Times New Roman")

but, then the font of “grading index” is Times New Roman, but the font of I_G is not changed with this syntax

Ah sorry you were just asking about I_G - this is rendered as LaTeX, so you could try some LaTeX commands for setting the font.