Gnuplot如何降低x轴的抽动数量

Cha*_*ang 6 axis gnuplot

这个数字有太多的xtics和ytics.我可以有一半吗?

我知道我可以用类似的方式手动设置抽搐:

set xtics (1,2,4,8,16,32,64,128,256,512,1024)
Run Code Online (Sandbox Code Playgroud)

但我觉得这不是一般解决方案.您无法为所有数字手动设置抽搐.我有很多它们,gnuplot代码是使用Java自动生成的.

以下是该图的代码:https://dl.dropboxusercontent.com/u/45318932/gnuplot2.plt

你能帮助降低x和y抽搐的数量吗?

在此输入图像描述

and*_*ras 11

gnuplot中没有选项可以在轴上显式设置所需的抽搐数量,并让gnuplot决定放置它们的位置.(我真的希望有.)

你有一个选择是使用stats命令(在gnuplot 4.6+中)找出数据的范围:

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
Run Code Online (Sandbox Code Playgroud)

您可能需要调整是否希望抽搐是否为整数值,但这是一般的想法.


Mig*_*uel 9

根据您想要做什么,有不同的方法来设置抽搐的数量.对于长度为2的固定段,从零开始到32结束:

set xrange [0:32]
set xtics 0,2,32
plot sin(x)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如果需要指数增量,请尝试以下操作

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

在此输入图像描述

或者您可以使用对数标度(在本例中为2):

set xrange [1:32]
set logscale x 2
plot sin(x)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

  • @Leo你可以再次提交一个功能请求:)`stats`方法的问题可能是,它很可能会产生可怕的tic步骤.Gnuplot通常会考虑自动缩放的tic位置,因此正确模拟它将包括正确舍入统计结果. (2认同)