# Common label for multiple legend entries using Plots.jl

**URL:** <https://discourse.julialang.org/t/common-label-for-multiple-legend-entries-using-plots-jl/117412>\
**Category:** Visualization\
**Tags:** plotting, plots\
**Created:** [July 24, 2024, 10:18am UTC](https://discourse.julialang.org/t/common-label-for-multiple-legend-entries-using-plots-jl/117412 "2024-07-24T10:18:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ultrapoci](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ultrapoci/32/25356_2.png) [@ultrapoci](https://discourse.julialang.org/u/ultrapoci)\
**Post date:** [July 24, 2024, 10:18am UTC](https://discourse.julialang.org/t/common-label-for-multiple-legend-entries-using-plots-jl/117412/1 "2024-07-24T10:18:37Z")

</div>

I have produced the following plot using Plots.jl, GR backend:

 ![immagine](https://global.discourse-cdn.com/julialang/original/3X/0/9/09f2ea87c7735f537ab203a8074d22a62b8c2cd0.jpeg)

Is it possible to have one label for each two lines in the legend? What I mean is, I would like to have a single label “60%-30%” for the red line and the orange dashed line (and the same for the remaining two entries).

---

<div class="post-metadata">

**Author:** ![mthelm85](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mthelm85/32/224164_2.png) [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Post date:** [July 24, 2024, 2:26pm UTC](https://discourse.julialang.org/t/common-label-for-multiple-legend-entries-using-plots-jl/117412/2 "2024-07-24T14:26:47Z")

</div>

I’ve used something like this in the past `plot(rand(30,4); labels=["A" "B" "" ""])`

---

<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:** [July 24, 2024, 3:21pm UTC](https://discourse.julialang.org/t/common-label-for-multiple-legend-entries-using-plots-jl/117412/3 "2024-07-24T15:21:45Z")

</div>

I didn’t want to post what Matt did as I assumed you wanted something fancier than that (maybe grouping two lines together next to one centered label), but not that he’s done it I’ll say if you want very fine grained legend control Plots might not be the right package for you and you’ll probably want to consider Makie.

---

<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:** [July 24, 2024, 7:27pm UTC](https://discourse.julialang.org/t/common-label-for-multiple-legend-entries-using-plots-jl/117412/4 "2024-07-24T19:27:19Z")

</div>

For another layout you can use the trick above (it requires a space `" "`, not `""`) and `legend_columns=2` to get:

 ![Plots_4curves_2labels](https://global.discourse-cdn.com/julialang/original/3X/7/4/7401b86b1b7d52bc3bbfd446d136c5048d9f3f7c.png)
