# ListPlot : range from $0$

I want to plot values of a table for example:

table = {0.456, 0.7899, 1.3456, 9.8908}


But I want to Plot points (x,y) like:

(0,0.456), (1,0.7899),(2,1.3456),(3,9.8908)


And the ListPlot commend generates the plot for vaues of x from range {1,10}, so points like: (1,0.456),(2,0.7899),(3,1.3456)... How can I change to plot from $0$ points which I described?

• See DataRange option for listplot. – ciao Jan 9 '14 at 0:20
• I was trying to use DataRange, but then I had a mess with the points and I never could achieve this points which I want – Ziva Jan 9 '14 at 0:22
• ListPlot[Table[{i,i}, {i, 0, 10}]] – Dr. belisarius Jan 9 '14 at 0:24
• @Ziva: Not sure what you mean - perhaps you can provide an example? For your OP example, ListPlot[Table[i, {i, 0, 10}], DataRange -> {0, 10}], e,g,, gives what you appear to be asking for. – ciao Jan 9 '14 at 0:25
• Or, in your new example, ListPlot[table, DataRange -> {0, Length[table] - 1}] – ciao Jan 9 '14 at 0:29

This will do what you want:

ListPlot[table, DataRange -> {0, Length[table] - 1}]

table = {2, 4, 8, 16};
ListLinePlot[Transpose[{Range[0, Length@# - 1], #}]] &@table


Or:

ListLinePlot[#, DataRange -> {0, Length@# - 1}] &@table

• Thanks! Rasher helped me how to solve my problem, but your solution is also very nice! – Ziva Jan 9 '14 at 1:21