# PyPlot legend font

**URL:** <https://discourse.julialang.org/t/pyplot-legend-font/82647>\
**Category:** New to Julia\
**Created:** [June 12, 2022, 9:53pm UTC](https://discourse.julialang.org/t/pyplot-legend-font/82647 "2022-06-12T21:53:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marllos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marllos/32/205917_2.png) [@marllos](https://discourse.julialang.org/u/marllos)\
**Post date:** [June 12, 2022, 9:53pm UTC](https://discourse.julialang.org/t/pyplot-legend-font/82647/1 "2022-06-12T21:53:29Z")

</div>

Hello everyone. I need to change the font legend in PyPlot. I have searched and can’t find a natural way to do it.  
Font.legend.family = monospace.

---

<div class="post-metadata">

**Author:** ![fedoroff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fedoroff/32/53209_2.png) [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Post date:** [June 13, 2022, 4:19am UTC](https://discourse.julialang.org/t/pyplot-legend-font/82647/2 "2022-06-13T04:19:44Z")

</div>

PyPlot shares the matplotlib interface. Therefore, it is always possible to refer to the matplotlib documentation:  
[https://matplotlib.org/stable/api/\_as\_gen/matplotlib.pyplot.legend.html](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.legend.html) (see the “prop” option description)  
[https://matplotlib.org/stable/api/font\_manager\_api.html#matplotlib.font\_manager.FontProperties](https://matplotlib.org/stable/api/font_manager_api.html#matplotlib.font_manager.FontProperties) (for possible font options)

The MWE will be the following:

```julia
using PyPlot

x = range(-4.0, 4.0, length=100)
y = @. exp(-x^2)

plot(x, y, label="Gaussian")

font = matplotlib.font_manager.FontProperties(
    family = "monospace",
    weight = "bold",
    style = "italic",
    size = 16,
)

legend(prop=font)

```

![Figure_1](https://global.discourse-cdn.com/julialang/original/3X/a/4/a46e84019968b0759c0ac2c26b7fb0dd9d159536.png)

---

<div class="post-metadata">

**Author:** ![marllos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marllos/32/205917_2.png) [@marllos](https://discourse.julialang.org/u/marllos)\
**Post date:** [June 13, 2022, 4:33pm UTC](https://discourse.julialang.org/t/pyplot-legend-font/82647/3 "2022-06-13T16:33:08Z")

</div>

Very good, thank you.
