Ltoll
Ltoll

Reputation: 169

Color Gradient on datapoints based on rows in gnuplot

I Have a dataset with a whole bunch of rows corresponding to points (x,y) on the plane. I want to plot this collection of points with a gradient so the first point in the list is blue, and as it plots more and more points from the list it shifts to red.

Is there any way to do this in gnuplot? Any advice would be appreciated.

Upvotes: 0

Views: 2358

Answers (1)

user8153
user8153

Reputation: 4095

You can use the linecolor palette z option to do this. For example, if you have a datafile test.dat that looks like

1   1
2   2
3   3
4   4

then you can do

unset key
set palette defined ( 0 "blue", 1 "red" )
plot "test.dat" u 1:2:0 w p pt 7 ps 3 lc palette z

enter image description here

Upvotes: 2

Related Questions