我有以下dat文件,名为ls.dat:
# Gnuplot script file for "ls"
# Version Removed Added Modified
8.1 0 0 0
8.4 0 0 4
8.5 2 5 9
8.6 2 7 51
8.7 2 7 51
8.8 2 7 51
8.9 2 7 51
8.10 2 7 51
8.11 2 8 112
8.12 2 8 112
8.13 2 17 175
8.17 6 33 213
Run Code Online (Sandbox Code Playgroud)
我试图用这个绘图:
plot "ls.dat" using 1:2 title 'Removed' with lines,\
"ls.dat" using 1:3 title 'Added' with lines,\
"ls.dat" using 1:4 title 'Modified' with lines
Run Code Online (Sandbox Code Playgroud)
这将生成以下图表:

我期待的是三线图,它们都应该上涨,但速度不同.任何人都可以看到这里发生了什么?我敢肯定它一定是非常愚蠢的.
and*_*ras 27
我认为你的问题是你的版本号.尝试制作8.1 - > 8.01,依此类推.这应该把点放在正确的顺序.
或者,您可以绘制using X,其中X是您想要的列号,而不是using 1:X.这将绘制y轴上的这些值和x轴上的整数.尝试:
plot "ls.dat" using 2 title 'Removed' with lines, \
"ls.dat" using 3 title 'Added' with lines, \
"ls.dat" using 4 title 'Modified' with lines
Run Code Online (Sandbox Code Playgroud)
mgi*_*son 11
安德拉斯是完全正确的.一个小的补充,尝试这个(例如)
plot 'ls.dat' using 4:xtic(1)
Run Code Online (Sandbox Code Playgroud)
这将使您的数据文件保持正确的顺序,但也保留x轴上的版本标签.
除了上面的答案,下面的命令也可以使用。我发布它是因为它对我更有意义。在每种情况下,它都是“使用 x 值列:y 值列”
plot 'ls.dat' using 1:2, 'ls.dat' using 1:3, 'ls.dat' using 1:4
Run Code Online (Sandbox Code Playgroud)
请注意,上面的命令假设您有一个以ls.dat制表符分隔的数据列命名的文件,其中第 1 列是 x,第 2 列是 y1,第 3 列是 y2,第 4 列是 y3。