# Error in legend

**URL:** <https://discourse.julialang.org/t/error-in-legend/45156>\
**Category:** New to Julia\
**Created:** [August 18, 2020, 1:12pm UTC](https://discourse.julialang.org/t/error-in-legend/45156 "2020-08-18T13:12:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [August 18, 2020, 1:12pm UTC](https://discourse.julialang.org/t/error-in-legend/45156/1 "2020-08-18T13:12:15Z")

</div>

Dear all,  
I have a litte problem in plot a graph using a layout: I would like each legend in each graph, but this not happen, as we can see:

```julia
using DifferentialEquations
using Plots
plotly()

function SIR!(du,u,p,t)
    du[1] = -p[1]*u[1]*u[2]                  
    du[2] = p[1]*u[1]*u[2] - p[2]*u[2]
    du[3] = p[2]*u[2]
end
p = [0.8;0.2]
u0 = [0.9;0.1;0.0]   
tspan = (0.0,50.0)    

prob = ODEProblem(SIR!,u0,tspan,p)
sol = solve(prob)

plot(sol,linewidth=2,xaxis="t",layout=(3,1),color=["red" "green" "blue"],label=["S(t)" "I(t)" "R(t)"])

```

Anyone can help me please?  
 ![SIR](https://global.discourse-cdn.com/julialang/original/3X/7/4/7438974342e22cf6eaf845e68199fe1b0799b4bb.png)

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [August 24, 2020, 12:56am UTC](https://discourse.julialang.org/t/error-in-legend/45156/2 "2020-08-24T00:56:21Z")

</div>

I think it is easier to plot separately:

```julia
plot(layout=(3,1))
plot!(sol[:,1],color="red",label="S(t)",subplot=1)
plot!(sol[:,2],color="green",label="I(t)",subplot=2)
plot!(sol[:,3],color="blue",label="R(t)",subplot=3,xlabel="t")

```

(I am guessing the structure of the “sol” data here)
