以文本列作为 X 轴的 Gnuplot 绘制数据

2 gnuplot

我有一个文本文件如下:

ls 10
cd 5
cut 12
awk 7
...
Run Code Online (Sandbox Code Playgroud)

我想使用 gnuplot 绘制它,并将文本列作为 X 轴:

plot 'data.txt' u 1:2
Run Code Online (Sandbox Code Playgroud)

但我收到这个错误:

         warning: Skipping data file with no valid points
                         ^
         x range is invalid

Run Code Online (Sandbox Code Playgroud)

Eth*_*han 6

$data << EOD
ls 10
cd 5
cut 12
awk 7
EOD

# this is all just plot layout stuff; customize to taste
unset border
set tics scale 0
set xzeroaxis
set title "x coord = line number"

# use line number for x coordinate, column 1 for tic label
plot $data using 0:2:xticlabel(1) with impulse
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述