plotcolorsgnuplotstrange-attractorlorenz-system

Gnuplot - Plot graph with continuously varying line color - plot with color fade / transition


I am using GNU plot (gnuplot) to plot some output data from integration of a strange attractor (see Wikipedia) - and as this is a strange attractor the line "rolls around itself in 3D space".

This makes it difficult to see what happens when plotting a lot of data. See this image: Lorenz System

Is there any way to plot a transitioning or fading color from say red at the start to blue at the end? I know gnuplot is a powerful tool but perhaps I ask too much?


Solution

  • I found an answer here: gnuplot

    # start value for H
    h1 = 117/360.0
    # end value for H
    h2 = 227/360.0
    # creating the palette by specifying H,S,V
    set palette model HSV functions (1-gray)*(h2-h1)+h1,1,0.68
    
    splot "output.csv" every 100 using 2:3:4:1 with lines linecolor palette title "Lorenz System"
    

    The 4th argument after using is the color variable to use. In my case this is the time variable. (Col 1)

    This is what it looks like now