I have a two colum txt file and I plot the data as below
MyColor(n) = n==0 ? 0x008000 : n==1 ? 0xFF0000 : n==2 ? 0x000000 : 0xFF8C00
plot datafile u 1:2:(MyColor(column(-2))) w l lw 1.0 lc rgb var notitle
This gives me bottom three lines in three different colour and others in the same colour (0xFF8C00), Left figure. But I want to plot only upto n==2 (there will be only three lines in the plot) and other row with 0xFF8C00 should not be in the plot and for each n (n==0 ? 0x008000 : n==1 ? 0xFF0000 : n==2 ? 0x000000) and I want to label a name with each colour as shown in right side figure.


help everyandhelp label.