# Legend bug in Plots?

**URL:** <https://discourse.julialang.org/t/legend-bug-in-plots/25891>\
**Category:** Visualization\
**Created:** [July 1, 2019, 12:37pm UTC](https://discourse.julialang.org/t/legend-bug-in-plots/25891 "2019-07-01T12:37:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [July 1, 2019, 12:37pm UTC](https://discourse.julialang.org/t/legend-bug-in-plots/25891/1 "2019-07-01T12:37:37Z")

</div>

I’m plotting a series of sub-plots using `Plots`. To illustrate things:

```julia
x = range(-2pi,2pi,length=100)
fig = [plot(x,sin.(x),legend=:top)]
push!(fig,plot(x,cos.(x),legend=:top))
plot(fig...)

```

produces

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/1/419fb93c06fe988515556345e76afb1f9120673a.png)

…which is not what I want. I was hoping that the legend location followed each of the subplots, i.e., that the label was located at the center top of each subplot.

What am I doing wrong?/How can I specify the legend location in each subplot?

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [July 1, 2019, 1:44pm UTC](https://discourse.julialang.org/t/legend-bug-in-plots/25891/2 "2019-07-01T13:44:03Z")

</div>

This problem appears to be related to the `GR` backend. When `using Plots` and the `pyplot` backend, I get the correct result:

```julia
pyplot()
x = range(-2pi,2pi,length=30)
pl = [plot(x,sin.(x),legend=:top)]
push!(pl,plot(x,cos.(x),legend=:top))
plot(pl...)

```

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