Search code examples
gnuplotcolormap

Gnuplot multiaxis colormap


I have some complicated data I would like to visualize.

For each point x and y in a uniform grid, there are two additional numbers, f(x,y) and g(x,y) and each goes between 0 and 1. I would like to visualize this data so that both are displayed. Since they are between 0 and 1, I was thinking of coloring with a color wheel and assign f to red and g to blue or something of that nature.

I could directly make an image by converting the pixel values into an image, but the image would be 50000x100 pixels. So gnuplot's range, interpolation, and of course axis/tics control would be the prefered way to go. No point in reinventing the [color] wheel if there is already a way to do this.


Solution

  • If the values of the functions f and g are stored in columns 3 and 4 then something like this should work:

    map(x) = floor(x*255.99999)   # map [0,1] to (0, 1, .. , 255)
    c(f,g) = 65536*map(f) + map(g)
    plot "data.dat" using 1:2:(c($3,$4)) with points linecolor rgb variable
    

    See help rgbcolor variable.