2

I want to plot several functions each with its own color. A MWE is as follows :

Plot[{2 x, 3 x}, {x, 0, 1}, PlotStyle -> {Red, Green}]

which works fine. Now, as I have more than just a few functions, I'd like to list them by way of a table :

Plot[Table[a x, {a, {2, 3}}], {x, 0, 1}, PlotStyle -> {Red, Green}]

Mathematica graphics

but both functions come out green (even without the PlotStyle options both lines are the same color). I am guessing that Mathematica applies the style to the table as a whole, but how do I modify the code in order to have several colors ?

A.G.
  • 4,362
  • 13
  • 18
  • 1
    Use Evaluate@Table[a x, {a, {2, 3}}] – Basheer Algohi Mar 18 '15 at 20:44
  • 2
    http://mathematica.stackexchange.com/questions/1731/plot-draws-list-of-curves-in-same-color-when-not-using-evaluate – Basheer Algohi Mar 18 '15 at 20:49
  • Indeed, the question http://mathematica.stackexchange.com/questions/1731/plot-draws-list-of-curves-in-same-color-when-not-using-evaluate asks why the answer to this question work. Thanks ! – A.G. Mar 18 '15 at 23:18

0 Answers0