# Single legend multiple plots - Plots, pyplot()

**URL:** <https://discourse.julialang.org/t/single-legend-multiple-plots-plots-pyplot/29486>\
**Category:** General Usage\
**Created:** [October 4, 2019, 12:51pm UTC](https://discourse.julialang.org/t/single-legend-multiple-plots-plots-pyplot/29486 "2019-10-04T12:51:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![juliauser](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Post date:** [October 4, 2019, 12:51pm UTC](https://discourse.julialang.org/t/single-legend-multiple-plots-plots-pyplot/29486/1 "2019-10-04T12:51:22Z")

</div>

Hi,

I am putting together 4 scatter plots that contain the same variables, so I would like 1 unique legend at the bottom of the plot. The following code generates one legend per graph

```julia
s1 = scatter(collect(1:10),collect(1:10))
s2 = scatter(collect(1:10),collect(1:10))
s3 = scatter(collect(1:10),collect(1:10))
s4 = scatter(collect(1:10),collect(1:10))

plot(s1,s2,s3,s4)
```

---

<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:** [October 4, 2019, 1:00pm UTC](https://discourse.julialang.org/t/single-legend-multiple-plots-plots-pyplot/29486/2 "2019-10-04T13:00:25Z")

</div>

Just add `legend = :none` to three of the calls? (on a phone so can’t verify that that’s the right kwarg…

---

<div class="post-metadata">

**Author:** ![juliauser](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Post date:** [October 4, 2019, 1:12pm UTC](https://discourse.julialang.org/t/single-legend-multiple-plots-plots-pyplot/29486/3 "2019-10-04T13:12:41Z")

</div>

Thanks. It is a partial solution, because it leaves the legend on one of them. I would like the legend to be on none of them, and place it on a separate line below the plot

---

<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:** [October 4, 2019, 1:26pm UTC](https://discourse.julialang.org/t/single-legend-multiple-plots-plots-pyplot/29486/4 "2019-10-04T13:26:17Z")

</div>

Ah right - I think there’s a keyword similar to `legend = :outerright` that puts the legend outside the plot

---

<div class="post-metadata">

**Author:** ![kdyrhage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdyrhage/32/2326_2.png) [@kdyrhage](https://discourse.julialang.org/u/kdyrhage)\
**Post date:** [October 4, 2019, 1:26pm UTC](https://discourse.julialang.org/t/single-legend-multiple-plots-plots-pyplot/29486/5 "2019-10-04T13:26:51Z")

</div>

You can also keep the legend in a separate plot:

```julia
s1 = scatter(1:10, 1:10, legend = false)
s2 = scatter(1:10, 1:10, legend = false)
s3 = scatter(1:10, 1:10, legend = false)
s4 = scatter(1:10, 1:10, legend = false)
legend = plot([0 0 0 0], showaxis = false, grid = false, label = ["s1" "s2" "s3" "s4"])
plot(s1, s2, s3, s4, legend, layout = @layout([[A B; C D] E{.1w}]))

```

Edit: Made it slightly more compact.

---

<div class="post-metadata">

**Author:** ![juliauser](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Post date:** [October 4, 2019, 6:47pm UTC](https://discourse.julialang.org/t/single-legend-multiple-plots-plots-pyplot/29486/6 "2019-10-04T18:47:08Z")

</div>

Thanks, this is helping a lot. Since I want to have the legend in the middle, I created a other two empty subplots, and I placed the one with the legend in the middle. This still leave a lot of white space under the figure. How can I adjust the size of each subplot? Also, how can I have the entries of the legend aligned horizontally?
