Search code examples
plotgnuplotpalette

Bringing to front points plotted in Gnuplot


Points in two colours

I have generated this picture with Gnuplot, shortly by means the flags below for the palette and plot:

set palette defined ( 0 "green", 1 "blue", 2 "blue", 3 "orange" )

plot "10steps_500" u 1:2:3 w p pt 7 ps 2.0 lt pal, "10steps_500-300" u 1:2:3 w p pt 7 ps 2.0 lt pal

However, I wanna bring the blue point to front. Someone knows how can we do it in gnuplot?


Solution

  • You need to first plot the green points, and then the others afterwards. It looks like you get the color information from the third column in your data files, so something like this should work:

    plot "10steps_500" u 1:($3 == 0 ? $2 : 1/0):3 w p pt 7 ps 2.0 lt pal, \
         "" u 1:($3 != 0 ? $2 : 1/0):3 w p pt 7 ps 2.0 lt pal
    

    This first line plots all the points for which the value in the third column is 0, and the second line plots all the other points.