# plotting an array of dataset with ListPlot

**URL:** <https://community.wolfram.com/t/plotting-an-array-of-dataset-with-listplot/1515>\
**Category:** Questions\
**Tags:** mathematica\
**Created:** [February 17, 2014, 10:22am UTC](https://community.wolfram.com/t/plotting-an-array-of-dataset-with-listplot/1515 "2014-02-17T10:22:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazzucat](https://avatars.discourse-cdn.com/v4/letter/m/3ec8ea/32.png) [@mazzucat](https://community.wolfram.com/u/mazzucat)\
**Post date:** [February 17, 2014, 10:22am UTC](https://community.wolfram.com/t/plotting-an-array-of-dataset-with-listplot/1515/1 "2014-02-17T10:22:40Z")

</div>

hi, I have a set of datapoints such as

```auto
val=3; (*this value is calculated before in the program, so it not known a priori*)
x={0,1,2,3};
data = Table[0, {val}];
For[i = 1, i < val + 1, i++,
 data[[i]] = x+i];

```

Now I can plot each of these data with ListPlot as

```auto
ListPlot[Transpose[{x,data[[1]]}]]

```

and if I want to plot more than one I can do

```auto
ListPlot[{Transpose[{x, data[[1]]}], Transpose[{x, data[[2]]}]}]

```

but how can I plot all of them in one code single line, by considering that val is calculated before in the program  
Is there a way to do something like  
For[i = 1, i \< val + 1, i++, ListPlot[Transpose[{x,data[\*]}]]…]?

I was thinking about the use of Show and overlap the graphs, but probably there is an easier solution

Any tutorial added to the answer is more than welcome  
Thanks  
Smazzu\*

---

<div class="post-metadata">

**Author:** ![mazzucat](https://avatars.discourse-cdn.com/v4/letter/m/3ec8ea/32.png) [@mazzucat](https://community.wolfram.com/u/mazzucat)\
**Post date:** [February 17, 2014, 10:44am UTC](https://community.wolfram.com/t/plotting-an-array-of-dataset-with-listplot/1515/2 "2014-02-17T10:44:02Z")

</div>

I thought I found the solution with

```auto
ListPlot[Insert[data,x,1]]

```

but the x value is not the right one  
Smazzu

---

<div class="post-metadata">

**Author:** ![iamorozov1](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/iamorozov1/32/17701_2.png) [@iamorozov1](https://community.wolfram.com/u/iamorozov1)\
**Post date:** [February 17, 2014, 11:27am UTC](https://community.wolfram.com/t/plotting-an-array-of-dataset-with-listplot/1515/3 "2014-02-17T11:27:00Z")

</div>

Hi,

```auto
 x = {0, 1, 2, 3};

(* do not use For or Do unless it's completely unavoidable *)
data = Table[x[[i]] + i, {i, 1, Length[x]}];
(* note now x and data have the same length *)
Length[x]
Length[data]
(* you can transpose only lists of an equal length *)
Transpose[{x, data}]
(* it's ready to plot *)
ListPlot[%]
(* use Show[] for different types of graphics *)

```

Not sure about a complete tutorial, but F1 can help, at least simple examples can be found there.  
Also try to search the web for solutions, many problems are already solved.

I.M.

---

<div class="post-metadata">

**Author:** ![mazzucat](https://avatars.discourse-cdn.com/v4/letter/m/3ec8ea/32.png) [@mazzucat](https://community.wolfram.com/u/mazzucat)\
**Post date:** [February 17, 2014, 12:49pm UTC](https://community.wolfram.com/t/plotting-an-array-of-dataset-with-listplot/1515/4 "2014-02-17T12:49:35Z")

</div>

Thanks but indeed it is not the answer to my problem.  
I need to plot all the data in different curves but in the same graph

```auto
{{1, 2, 3, 4}, {2, 3, 4, 5}, {3, 4, 5, 6}}

```

with x as common axis  
At the end I want to have a graph with val=3 curves, a kind of static way to plot

```auto
Manipulate[ListPlot[Transpose[{x, data[[i]]}]], {i, 1, val,1}]

```

Thanks  
Smazzu
