# PyPlot - Axis label, italic format for the symbol only

**URL:** <https://discourse.julialang.org/t/pyplot-axis-label-italic-format-for-the-symbol-only/16379>\
**Category:** New to Julia\
**Created:** [October 16, 2018, 1:43am UTC](https://discourse.julialang.org/t/pyplot-axis-label-italic-format-for-the-symbol-only/16379 "2018-10-16T01:43:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![QUANG\_VU\_NGUY\_N\_PH\_M](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quang_vu_nguy_n_ph_m/32/14299_2.png) [@QUANG\_VU\_NGUY\_N\_PH\_M](https://discourse.julialang.org/u/QUANG_VU_NGUY_N_PH_M)\
**Post date:** [October 16, 2018, 1:43am UTC](https://discourse.julialang.org/t/pyplot-axis-label-italic-format-for-the-symbol-only/16379/1 "2018-10-16T01:43:55Z")

</div>

![41](https://global.discourse-cdn.com/julialang/original/3X/e/b/ebbb6428db9763c47e47adc88462c7f1e981933e.png)

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.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [October 16, 2018, 7:37am UTC](https://discourse.julialang.org/t/pyplot-axis-label-italic-format-for-the-symbol-only/16379/2 "2018-10-16T07:37:25Z")

</div>

This should work:

```julia
xlabel = "grading index \$I_G\$"

```

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

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

```

---

<div class="post-metadata">

**Author:** ![QUANG\_VU\_NGUY\_N\_PH\_M](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quang_vu_nguy_n_ph_m/32/14299_2.png) [@QUANG\_VU\_NGUY\_N\_PH\_M](https://discourse.julialang.org/u/QUANG_VU_NGUY_N_PH_M)\
**Post date:** [October 16, 2018, 9:05am UTC](https://discourse.julialang.org/t/pyplot-axis-label-italic-format-for-the-symbol-only/16379/3 "2018-10-16T09:05:31Z")

</div>

Thank you very much! It worked perfectly

---

<div class="post-metadata">

**Author:** ![QUANG\_VU\_NGUY\_N\_PH\_M](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quang_vu_nguy_n_ph_m/32/14299_2.png) [@QUANG\_VU\_NGUY\_N\_PH\_M](https://discourse.julialang.org/u/QUANG_VU_NGUY_N_PH_M)\
**Post date:** [October 26, 2018, 6:16am UTC](https://discourse.julialang.org/t/pyplot-axis-label-italic-format-for-the-symbol-only/16379/4 "2018-10-26T06:16:04Z")

</div>

> [@nilshg](#):
>
> pyplot() plot(rand(100), xlabel = "grading index $I\_

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?

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [October 26, 2018, 8:58am UTC](https://discourse.julialang.org/t/pyplot-axis-label-italic-format-for-the-symbol-only/16379/5 "2018-10-26T08:58:59Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![QUANG\_VU\_NGUY\_N\_PH\_M](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quang_vu_nguy_n_ph_m/32/14299_2.png) [@QUANG\_VU\_NGUY\_N\_PH\_M](https://discourse.julialang.org/u/QUANG_VU_NGUY_N_PH_M)\
**Post date:** [October 26, 2018, 9:35am UTC](https://discourse.julialang.org/t/pyplot-axis-label-italic-format-for-the-symbol-only/16379/6 "2018-10-26T09:35:34Z")

</div>

In Julia, the command is like this:

```julia
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

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [October 26, 2018, 1:35pm UTC](https://discourse.julialang.org/t/pyplot-axis-label-italic-format-for-the-symbol-only/16379/7 "2018-10-26T13:35:52Z")

</div>

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.
