# Plotting data with ListPlot where the coloration of the data depends on its position in an array?

Imagine I have some data in a list I'd like to plot using ListPlot in Mathematica 9, for example:

ListPlot[Table[{i, Cos[i]}, {i, 1, 10^3}]]


How can I specify that the data points should be colored according to a linearly scaling interval from one RGB value to another (e.g. Red --> Blue, Green --> Red, etc.) depending on the point's index in the array? Can we do something similar using ListPointPlot3D?

ListPointPlot3D[Table[{i, Cos[i], Sin[i]}, {i, 1, 10^3}]]

-
Have you looked at ColorFunction‌​? – Ali Jun 28 '13 at 5:45
@Ali Yes, but I couldn't see how to make it work with the index of the datapoints instead of their values? – FlavorOfLife Jun 28 '13 at 6:22
How is this: ListPointPlot3D[Table[{i, Cos[i], Sin[i]}, {i, 1, 10^3}], ColorFunction -> Function[{x, y, z}, Hue[x]]] – Ali Jun 28 '13 at 6:27
ColorFunctionScaling -> False will pass the unscaled x coordinate of the point to the colour function (I think). – cormullion Jun 28 '13 at 7:19

ListLinePlot[Table[{i, Cos[i]}, {i, 1, 10^3}],