0
$\begingroup$

This question already has an answer here:

I am trying to use plotlegend for solutions I've obtained using NDSolve. I have

Plot[{a[z], b[z]} /. sol , {z, 0, L}, PlotLegends -> {"1", "2"}]

It doesn't work because I am using ./sol

How can I fix this?

Thanks in advance...

$\endgroup$

marked as duplicate by chuy, m_goldberg, MarcoB, garej, Henrik Schumacher May 5 at 17:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ The documentation seems to indicate Evaluate is required. Does Plot[Evaluate[{a[z], b[z]}/.sol], {z, 0, L}, PlotLegends -> {"1", "2"}] work? $\endgroup$ – MassDefect May 3 at 15:53
2
$\begingroup$

Evaluate the list first:

Plot[Evaluate[{a[z], b[z]} /. sol] , {z, 0, L}, PlotLegends -> {"1", "2"}]
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.