Question: I have a datafile that looks like this:

```
1 1.0 0
2 1.5 0
3 0.0 1
4 1.2 2
5 1.0 1
6 1.1 1

```

where the first column is my X value, the second column is my Y value, and the third column is a color. I'd like for each line segment to be colored according to the third column. So the first two line segments would be "color 1", the next would be "color 2", the next would be "color 3", and the final two would be "color 1" again.

I tried:

```
plot 'file.dat' using 1:2:3 with lines rgb variable;

```

But my line was all black.

Is this possible in gnuplot?

Thanks,
Gabe

Answer: 
This following works for me (gnuplot 4.4)

```
plot "./file.dat" u 1:2:3 with lines  palette

```

Hope this helps.

When I ran your code gnuplot couldn't pass the "rgb" part.

For an example of using the variable tag see the similar question: 
[GNUPLOT: dot plot with data depending dot size](https://stackoverflow.com/questions/2689403/gnuplot-dot-plot-with-data-depending-dot-size/2689498#2689498)

with the useful examples found here:
<http://gnuplot.sourceforge.net/demo/pointsize.html>

All the best

Tom
```
plot 'foo.dat' with lines linecolor variable

```

or abbreviated:

```
plot 'foo.dat' w l lc var

```