如何绘制点标记数据?

Jua*_*nti 7 gnuplot

我想打开一个文件,如:

Name  X  Y
a     1  2
b     4  1
s     3  3
Run Code Online (Sandbox Code Playgroud)

在 XY 图形中,XY 点标有名称。

我该怎么做?我认为这可以用 gnuplot 来完成,但我还不能做到。

mru*_*cci 6

您可以使用以下 gnuplot 命令将标签放置在距点的指定偏移处:

echo "plot 'file.dat' using 2:3 pt 2 notitle, '' using 2:3:1 with labels offset 0.5,0.5 notitle;" | gnuplot -persist
Run Code Online (Sandbox Code Playgroud)

注意:仅当使用 --enable-datastrings 编译 gnuplot 时才有效(感谢 DaveParillo 的澄清)

  • 仅供参考:如果此示例不适用于某人 - 只有使用配置选项 --enable-datastrings 构建 gnuplot 时,`labels` 样式才可用 (3认同)