gnuplot splot colors based on a fourth column of the data file

gnuplot

Solution

set style line 1 lc rgb "red"
set style line 2 lc rgb "blue"
set style line 3 lc rgb "green"
splot 'datafile' u 1:2:3:4 lc variable

Problem

I have a data file with 4-column data, the first three columns specify a point (x,y,z) and the fourth is either a 1, 2, or 3 - I want the point to be colored based on the value of the fourth column (i.e., if it's a 2, color the point red, if 3, green, if 1, blue)

Original source

Related problems