# Two lines one label - Makie

**URL:** https://discourse.julialang.org/t/two-lines-one-label-makie/101490
**Category:** Visualization
**Tags:** plotting, makie
**Created:** [July 11, 2023, 3:58pm UTC](https://discourse.julialang.org/t/two-lines-one-label-makie/101490 "2023-07-11T15:58:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![xztt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xztt/32/33843_2.png) [@xztt](https://discourse.julialang.org/u/xztt)
#### Post date: [July 11, 2023, 3:58pm UTC](https://discourse.julialang.org/t/two-lines-one-label-makie/101490/1 "2023-07-11T15:58:51Z")

</div>

Hi,

From the basic tutorials we have the code

```julia
fig = Figure()
ax1, l1 = lines(fig[1, 1], 0..10, sin, color = :red)
ax2, l2 = lines(fig[2, 1], 0..10, cos, color = :blue)
Legend(fig[1:2, 2], [l1, l2], ["sin", "cos"])
fig

```

Which produces

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/6/e6aae2f93703f4228a630e38e05d7ceded63c0b8.png)

I am wondering if there would be a way such that in the legend the red and blue line could be attributed to the label “sin”?

I have tried various things to no success.

Cheers,  
harry

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [July 11, 2023, 4:28pm UTC](https://discourse.julialang.org/t/two-lines-one-label-makie/101490/2 "2023-07-11T16:28:03Z")

</div>

You mean like two parallel lines, one red, one blue, next to the `sin` entry?

---

<div class="post-metadata">

### Author: ![xztt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xztt/32/33843_2.png) [@xztt](https://discourse.julialang.org/u/xztt)
#### Post date: [July 11, 2023, 4:29pm UTC](https://discourse.julialang.org/t/two-lines-one-label-makie/101490/3 "2023-07-11T16:29:32Z")

</div>

Yes that is what I mean 🙂

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [July 11, 2023, 4:34pm UTC](https://discourse.julialang.org/t/two-lines-one-label-makie/101490/4 "2023-07-11T16:34:36Z")

</div>

Not using the `label` shortcut currently, I think. Or at least not directly. But you can build the `LineElements` yourself, specifying the points so they don’t overlap:

```julia
 f = Figure()
 Legend(f[1, 1], [[LineElement(color = :red, points = Point2f[(0, 0.75), (1, 0.75)]), LineElement(color = :blue, points = Point2f[(0, 0.25), (1, 0.25)])]], ["sin"])
 f

```

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