Gnuplot how to lower the number of tics in x axis

前端 未结 4 402
故里飘歌
故里飘歌 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:35

    There are different ways to set the number of tics depending on what exactly you want to do. For a fixed segment of length 2, starting at zero and ending at 32:

    set xrange [0:32]
    set xtics 0,2,32
    plot sin(x)
    

    enter image description here

    If you want an exponential increment, try the following

    set xrange [0:32]
    set for [i=0:5] xtics (0,2**i)
    plot sin(x)
    

    enter image description here

    Or you can use a logarithmic scale (in base 2 in this case):

    set xrange [1:32]
    set logscale x 2
    plot sin(x)
    

    enter image description here

提交回复
热议问题