0
$\begingroup$

This question already has an answer here:

I have plotted

    Clear[Expr1, Expr2]

    Expr1 = x*(1/Sin[Pi x/2])^α


(* x Csc[(π x)/2]^α *)

Expr2 = Normal[Series[Expr1, {x, 0, 5}]]


(* (1/
      x)^α ((2/π)^α x + 
       1/3 2^(-3 + α) π^(2 - α) x^3 α + 
       1/45 2^(-7 + α) π^(4 - α)
         x^5 α (2 + 5 α)) *)

Plot[
     Table[{Expr1, Expr2}, {α, -1, 1, 0.25}], {x, 0, 1}, 
     PlotLegends -> Table[α, {α, -1, 1, 0.25}]]

but all plots appeared in one color and with one legend key

enter image description here

how to fix?

$\endgroup$

marked as duplicate by Szabolcs, bbgodfrey, Dr. belisarius plotting Apr 22 '15 at 17:38

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$ Use the Evaluated ->True Option $\endgroup$ – Dr. belisarius Apr 22 '15 at 15:54
  • $\begingroup$ @Suzan Cioc Please edit questions to contain only relevant information. Your comments are "noise." $\endgroup$ – David G. Stork Apr 22 '15 at 17:06
1
$\begingroup$

I did a quick fix:

tbl = Table[{Expr1, Expr2}, {\[Alpha], -1, 1, 0.25}];
leg = Table[\[Alpha], {\[Alpha], -1, 1, 0.25}];

Plot[tbl, {x, 0, 1}, PlotLegends -> leg]

which seems to work: enter image description here

$\endgroup$
  • $\begingroup$ Huh?! I don't have M handy to check, but Plot[Table[...], ...] returns all in one color, while tbl=Table[...]; Plot[tbl...] works fine? I'd have always put an Evaluate such as Plot[Evaluate@tbl...] $\endgroup$ – LLlAMnYP Apr 22 '15 at 20:45

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