Search code examples
gnuplot

Can I plot 1D heatmap with gnuplot?


I'm trying to plot a 1D heatmap using two columns of data (x value and y value) in gnuplot. The linegraph plotted using my data is like this:

Linegraph: enter image description here

However after some trying I can only achieve this:

What I've got: enter image description here

And what I want to get is something like this. (Only example)

What I want:

enter image description here

The gnuplot script that I use is as follows:

set view map
set size ratio 0.2
unset ytics
unset key
splot 'test.dat' u 1:(1):2 palette

Could anyone help please?


Solution

  • I would do it like this:

    unset key
    set xrange noextend
    set offset 0,0,graph .05,graph .05
    set palette cubehelix negative
    
    plot 'foo.dat' using 0:3 with lines lc "black", \
         'foo.dat' using 0:(70):3 with lines lc palette lw 10
    

    enter image description here