# order items of a table

I am trying to change order of a table.

n1 := {6., 3.31791383741595, 2.549684922097378, 2.2444170593578363,
2.109892159984955, 2.0489264006542918, 2.0214035890309514, 2.009186379955868,
2.0038735759286572, 2.0016085340677456, 2.0006594467480365, 2.000267493804639}

ListLinePlot[n1, DataRange -> {0, 11}]


This is for the graph with the datarange from 0 to 11. However I want to get the graph start at -11 and end at 0. (From the table, n1, 6 is at 0 and 3.3179 is at -1, 2.54 is at -2,...,2.0002674 is at -11.) Is there any good way to do this?

• Does ListLinePlot[n1 // Reverse, DataRange -> {-11, 0}] suit your needs? – J. M. will be back soon Jun 5 '13 at 3:25
• The title is very misleading, as this has nothing to do with Table, but with lists and plotting. – Ajasja Jun 5 '13 at 10:24

J.M.'s suggestion (in the comments) is simple and effective.

Another way is to assign an x-axis value to each datapoint like so:

points1 = Transpose[{-1*(Range@Length@n1 - 1), n1}]


{{0, 6.}, {-1, 3.31791}, {-2, 2.54968}, {-3, 2.24442}, {-4, 2.10989}, {-5, 2.04893}, {-6, 2.0214}, {-7, 2.00919}, {-8, 2.00387}, {-9, 2.00161}, {-10, 2.00066}, {-11, 2.00027}}

Then use ListPlot instead of ListLinePlotlike:

ListPlot[points1,Joined->True]


Depending on your reasons for plotting these numbers (and what you want to do with them next) this may be a more versatile approach.

• Better to use something like Range[0, -11, -1], I'd think. One might also consider MapIndexed[] in this case. – J. M. will be back soon Jun 5 '13 at 10:57