# How to draw this kind of plot?

Apologies if the question is too basic; I've searched the manual and the web but couldn't find a solution.

I would like to present some data on a discrete plot. The data is divided into $K$ series or numbers, $y_{k,1}, y_{k,2},\dots, y_{k,r_k}$ (with length $r_k$ depending on $k$, but is small). I would like to plot points corresponding to numbers in one series on a vertical line corresponding to the series. So, on the line ${x=1}$, one unit left of the $y$-axis, I would like to place all the points $y_{1,1}, y_{1,2},\dots, y_{1,r_1}$; then on the line ${x=2}$ I would like to place all the points $y_{2,1}, y_{2,2},\dots, y_{1,r_2}$; and so on. Thus, the points I need on the plot have coordinates $(i,y_{k,i})$. I'm fairly sure Mathematica has something like this as a built in type of plot, but I can't find it. Any help will be appreciated.

Build a sample list

b = Table[RandomReal[{0, 1}, k], {k, 8}]


Plot it:

ListPlot@MapIndexed[Function[{elem, idx}, {idx[[1]], #} & /@ elem], b]


Edit

Also

ListPlot@MapIndexed[Function[{elem, idx}, {idx[[1]], elem}], b, {2}]


And this is another way, without using MapIndexed[]

ListPlot@MapThread[Thread[{#2, #1}] &, {b, Range@Length@b}]

• Thank you! That's exactly what I needed. Commented Nov 2, 2013 at 3:28