# Plots.jl : place legend at the end of series

**URL:** https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287
**Category:** Visualization
**Tags:** plotting, plots
**Created:** [February 16, 2024, 10:04am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287 "2024-02-16T10:04:16Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![lrnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lrnv/32/19373_2.png) [@lrnv](https://discourse.julialang.org/u/lrnv)
#### Post date: [February 16, 2024, 10:04am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/1 "2024-02-16T10:04:16Z")

</div>

Hey,

I have a plot like that :

![image](https://global.discourse-cdn.com/julialang/original/3X/b/d/bdbe2745be2ad20d0d593d9a8af57224ea421c90.png)

I would like the legends to be placed next to the end of curves like that :

![image](https://global.discourse-cdn.com/julialang/original/3X/c/b/cbb4ec401b470d2e7f8b68e53c704aa050141671.png)

and so on for all of them. Is that possible ?

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [February 16, 2024, 10:15am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/2 "2024-02-16T10:15:16Z")

</div>

You should be able to use annotations for this  
[https://docs.juliaplots.org/stable/gallery/gr/generated/gr-ref020/#gr\_ref020](https://docs.juliaplots.org/stable/gallery/gr/generated/gr-ref020/#gr_ref020)

---

<div class="post-metadata">

### Author: ![lrnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lrnv/32/19373_2.png) [@lrnv](https://discourse.julialang.org/u/lrnv)
#### Post date: [February 16, 2024, 10:20am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/3 "2024-02-16T10:20:29Z")

</div>

Exactly what i need, thank you very much.

---

<div class="post-metadata">

### Author: ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)
#### Post date: [February 16, 2024, 11:06am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/4 "2024-02-16T11:06:30Z")

</div>

The GR backend actually has this implemented

```julia
using Plots

plot(Plots.fakedata(4,4), legend=:inline)

```

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [February 16, 2024, 11:11am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/5 "2024-02-16T11:11:36Z")

</div>

> [@BeastyBlacksmith](#):
>
> `plot(Plots.fakedata(4,4), legend=:inline)`

That does not appear to work here, is that a recent addition?

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/d/cdcea15da04f60c0e9e9da43a6616f9522de5461.png)

---

<div class="post-metadata">

### Author: ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)
#### Post date: [February 16, 2024, 11:12am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/6 "2024-02-16T11:12:19Z")

</div>

what is your version? I’m on Plots v1.39.0

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [February 16, 2024, 11:13am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/7 "2024-02-16T11:13:10Z")

</div>

1.40.1

---

<div class="post-metadata">

### Author: ![lrnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lrnv/32/19373_2.png) [@lrnv](https://discourse.julialang.org/u/lrnv)
#### Post date: [February 16, 2024, 11:13am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/8 "2024-02-16T11:13:51Z")

</div>

Worked like a charm for me :

 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/0/d0654f70b06ff3e8b513ab952a335beacc00d7bb.png)

I have Plots v1.39.0.

---

<div class="post-metadata">

### Author: ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)
#### Post date: [February 16, 2024, 11:15am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/9 "2024-02-16T11:15:08Z")

</div>

are you on a different backend then?

---

<div class="post-metadata">

### Author: ![lrnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lrnv/32/19373_2.png) [@lrnv](https://discourse.julialang.org/u/lrnv)
#### Post date: [February 16, 2024, 11:16am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/11 "2024-02-16T11:16:13Z")

</div>

How can i check by backend ?

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [February 16, 2024, 11:16am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/12 "2024-02-16T11:16:21Z")

</div>

wow, I’m an idiot 🙂  
I almost always use GR, but I had switched to plotly in this session and couldn’t spot the difference between the plots. Sorry for the confusion 😮

---

<div class="post-metadata">

### Author: ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)
#### Post date: [February 16, 2024, 11:17am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/13 "2024-02-16T11:17:08Z")

</div>

```julia
backend()

```

---

<div class="post-metadata">

### Author: ![lrnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lrnv/32/19373_2.png) [@lrnv](https://discourse.julialang.org/u/lrnv)
#### Post date: [February 16, 2024, 11:31am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/14 "2024-02-16T11:31:57Z")

</div>

So i do have the GR backend indeed.  
Thaks a lot for the :inline legend !

---

<div class="post-metadata">

### Author: ![liuyxpp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liuyxpp/32/9870_2.png) [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)
#### Post date: [February 16, 2024, 11:49am UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/15 "2024-02-16T11:49:17Z")

</div>

This is neat. I wish Makie had this as well.

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [February 16, 2024, 1:26pm UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/16 "2024-02-16T13:26:58Z")

</div>

Is it possible to have the `legendfontcolor` attribute matching the curves colors?

---

<div class="post-metadata">

### Author: ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)
#### Post date: [February 16, 2024, 3:54pm UTC](https://discourse.julialang.org/t/plots-jl-place-legend-at-the-end-of-series/110287/17 "2024-02-16T15:54:32Z")

</div>

I think that is a subplot attribute and not a seriesattribute.
