Search code examples
listfor-loopplotwolfram-mathematica

How to make many plots, with functions For and Plot?


I need to make several plots and i'm trying to do it with the help of For. My data:

0.0023709,8.5752e-007,4.847e-008

My code:

column1 = data[[All,1]]
For[i = 1, i < 4, Plot[column1[[i]]*t, {t, 0, 10}]]

After running Mathematica write "Running" and that's all. I want make several plots for some lists and export them. Please, help me to solve this problem.


Solution

  • First, using For like your code.

    data = {{1, 0}, {2, 0}, {3, 0}};
    output = {};
    column1 = data[[All, 1]];
     For[i = 1, i < 4, i++,
      AppendTo[output,
       ListPlot[Table[column1[[i]]*t, {t, 0, 10}]]]]
    output 
    

    Second, an equivalent method.

    output = Table[ListPlot[Table[column1[[i]]*t, {t, 0, 10}]], {i, 1, 3}]