Gnuplot heatmap XYZ

28,658

Solution 1

set pm3d interpolate 2,2
splot "file"

You can adjust level of interpolation by changing the number or even set it as 0 to tell gnuplot to "guess" it. It is not well documented what interpolation method that gnuplot is using, so be careful.

set pm3d interpolate 0,0
splot "file"

Here's the result without interpolation:

no interpolation

Here's the result with interpolation 2,2:

set pm3d interpolate 2,2

Here's the result with interpolation 0,0:

set pm3d interpolate 0,0

Solution 2

Use the pm3d option:

set pm3d
splot "file"
Share:
28,658
Nikko
Author by

Nikko

Astrophysicist from Chile, living in Bonn.

Updated on July 09, 2022

Comments

  • Nikko
    Nikko almost 2 years

    Hey guys I'm trying to do a real heat map like in A true heat map in R, but in GNUPLOT.

    My file is like

    3 1 2
    3 4 3
    3 5 5
    
    4 1 7
    4 1 2
    4 4 3
    4 5 2
    
    5 1 3
    5 1 2
    5 4 3
    
    .
    ..
    ....
    

    and I've tried with

    plot "file" using 1:2:3 with image

    splot "file" using 1:2:3 p3md

    etc..

    Also I follow this example http://gnuplot.sourceforge.net/demo/heatmaps.html, but nothing.

    Can someone shed some light here please?

    Thanks

  • Nikko
    Nikko about 10 years
    I get this: Warning: Single isoline (scan) is not enough for a pm3d plot. Hint: Missing blank lines in the data file? See 'help pm3d' and FAQ. Floating point exception (core dumped)
  • alex
    alex over 9 years
    I think you should also add "set dgrid3d"
  • Scrimbibete
    Scrimbibete over 4 years
    You may want to check this hirophysics.com/gnuplot/gnuplot10.html