# ListPlot problem

I have the following example:

x = {1, 2, 3, 4}
y = {{1, 2, 3, 4}, {2, 3, 4, 5}, {3, 4, 5, 6}, {4, 5, 6, 7}}


Now I can plot:

ListPlot[{Transpose[{x, y[]}], Transpose[{x, y[]}],
Transpose[{x, y[]}], Transpose[{x, y[]}]}] How can this be simplified?

• Have you tried Map to avoid typing the same thing four times?? – Szabolcs May 27 '16 at 13:32
• Map[(Transpose[{x, #}]) &, y] ? – mrz May 27 '16 at 13:32
• Yes, or just Transpose[{x,#}]& /@ y if you find that more readable. – Szabolcs May 27 '16 at 13:33
• With your x use the default: ListPlot[y] – Bob Hanlon May 27 '16 at 17:27
• @Bob Hanson: For my analysis in general x is not a list of of consecutive integers. – mrz May 28 '16 at 7:23

If you want to simplify generating the input these are simpler ways:

x = Range;
y = Partition[ Range, 4, 1];


then you can use Inner:

z = Inner[List, x, y, List];


and finally

ListPlot[z]


Instead of playing with Partition and Range you can generate the input of ListPlot with Table:

z = Table[{i, i + k - 1}, {k, 4}, {i, 4}];


or even better with Array:

z = Array[{#2, #2 + #1 - 1} &, {4, 4}]


The simplest approach would make use of the Front - end shorthands for Transpose (esc tr esc) (see e.g. Add a vector to a list of vectors) and Map (/@) e.g. 