# Changing font style for latex rendering using PyPlot

**URL:** <https://discourse.julialang.org/t/changing-font-style-for-latex-rendering-using-pyplot/5910>\
**Category:** Visualization\
**Tags:** pyplot, fonts\
**Created:** [September 15, 2017, 7:20pm UTC](https://discourse.julialang.org/t/changing-font-style-for-latex-rendering-using-pyplot/5910 "2017-09-15T19:20:03Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Paul\_Soderlind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_soderlind/32/1753_2.png) [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Post date:** [September 19, 2018, 2:16pm UTC](https://discourse.julialang.org/t/changing-font-style-for-latex-rendering-using-pyplot/5910/11 "2018-09-19T14:16:25Z")

</div>

You can also try this (seems to work well also in IJulia)

```julia
PyPlot.matplotlib[:rc]("mathtext",fontset="cm") #computer modern font 
PyPlot.matplotlib[:rc]("font",family="serif",size=12) #font similar to LaTeX
figure(figsize=(7,5))
  plot(x,y)
  title(L"a title using LaTeX, $2 b^2 + 0.5$")
  xlabel(L"$x$")
  ylabel("function value")
  text(-2.5,0.9,L"some text, $\ln(\mathrm{loss})$")
  text(-2.5,5,L"$\mu_2 = \int x^2 f(x) dx$")

```

In case you like TImes-Roman, try this

```julia
PyPlot.matplotlib[:rc]("mathtext",fontset="stix")
PyPlot.matplotlib[:rc]("font",family="STIXGeneral",style="normal",size=18)
...

```

---

_[View the full topic](https://discourse.julialang.org/t/changing-font-style-for-latex-rendering-using-pyplot/5910)._
