Search code examples
gnuplot

How to differentiate between two types of coordinates in a single .txt file


I have a .txt file containing lines with 2D coordinates, followed by a color indicator, in the following format:

x    y   i
1    0   1
1    1   0
...

I want to plot the points on a single graph, those with different i in a different colour (i takes only two values). How can I do that?


Solution

  • Just use linecolor variable and include the column into the using clause:

    plot "file.txt" using 1:2:3 with points linecolor variable