Search code examples
integergnuplotgranularity

gnuplot: only integer values on axis x


How can I visualize on axis x only the integer values?

I plot the function described in a file like this

0   0.5
1   0.25
2   0.125
3   0.0625
4   0

whit these commands:

set xrange [0:4]
plot "./data_file" using 1:2 with line lw 2

The problem is that, by doing so, I visualize on axis x the values 0; 0.5; 1; 1.5; 2; 2.5; 3; 3.5; 4 How can I visualize only the integer values 0; 1; 2; 3; 4?

Thank you


Solution

  • help set
    
    help set xtics
    
    set xtics 1
    

    as mgilson notes in the comments, set xtics with a single argument defines an increment for the x axis.