Plots.jl : place legend at the end of series

Hey,

I have a plot like that :

image

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

image

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

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

3 Likes

Exactly what i need, thank you very much.

The GR backend actually has this implemented

using Plots

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

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

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

1.40.1

Worked like a charm for me :

I have Plots v1.39.0.

2 Likes

are you on a different backend then?

How can i check by backend ?

wow, I’m an idiot :slight_smile:
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 :open_mouth:

1 Like
backend()
1 Like

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

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

1 Like

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

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

1 Like