Gnuplot how to lower the number of tics in x axis

前端 未结 4 401
故里飘歌
故里飘歌 2020-12-06 18:42

The figure has too many xtics and ytics. Can I have half of them?

I know I can manually set tics in a way similar to this:

set xtics (1,2,4,8,16,32,6         


        
4条回答
  •  攒了一身酷
    2020-12-06 19:28

    There is no option in gnuplot to explicitly set the number of tics you want on an axis and have gnuplot decide where to put them. (I really wish there were.)

    One option you have is to use the stats command (in gnuplot 4.6+) to find out the range of the data:

    ntics = 4
    
    stats 'data.dat' using 1 name 'x' nooutput
    stats 'data.dat' using 2 name 'y' nooutput
    stats 'data.dat' using 3 name 'z' nooutput
    
    set xtics x_max/ntics
    set ytics y_max/ntics
    set ztics z_max/ntics
    

    You might have to adjust whether you want the tics to be at integer values or not, but that is the general idea.

提交回复
热议问题