需要带有标签的 gnuplot 框

Rus*_*lex 4 gnuplot

我正在尝试绘制一个简单的 gnuplot 条形图。每个栏顶部都有标签。

这是我的测试

279 2 10149
286 1 699999
295 3 14098
Run Code Online (Sandbox Code Playgroud)

这是我的命令:

echo "set terminal dumb size 70,30; plot 'test.out' using 3:xtic(1) with boxes" | gnuplot

它画了一个盒子。我还想在每个顶部贴上标签。

请帮忙 )

Chr*_*oph 5

您必须重新绘制数据with labels

要获得正确的 x 位置,您必须知道在绘图命令中,plot 'test.out' using 3:xtic(1) with boxesx 位置隐式地视为行号。

此外,绘图时with labels最好明确设置标签字符串的格式。仅使用列可能有效,也可能无效,并且可能会产生令人惊讶的结果,具体取决于您的数据。

所以,简而言之:

plot 'test.out' using 0:3:xtic(1) with boxes,\
    '' using 0:3:(strcol(3)) with labels offset 0,1
Run Code Online (Sandbox Code Playgroud)

这会将第 3 列的字符串内容绘制为位置(行号,第 3 列的值)处的标签,并在 y 方向上移动 1 个字符高度。