在gnuplot中,如何使用坐标标记图中的每个点?

时间:2014-04-20 02:14:52

标签: gnuplot

我有一个数据文件,abc.dat,我想用标记每个坐标来绘制它,如(1,5),(4,6),(2,8)等......

abc.dat就像:

1  5
4  6
2  8
4  5
7  8
8  9
3  4

1 个答案:

答案 0 :(得分:21)

使用labels绘图样式。这需要三个using说明符:x值,y值和放置在给定坐标处的字符串。所以最简单的命令是:

plot 'abc.dat' using 1:2:(sprintf("(%d, %d)", $1, $2)) with labels notitle

将各个标签置于坐标中心。

以下命令在相应坐标处绘制一个点,并将坐标标签稍微移位到它附近:

set offset 1,1,1,1
plot 'abc.dat' using 1:2:(sprintf("(%d, %d)", $1, $2)) with labels point  pt 7 offset char 1,1 notitle

4.6.4的结果是:

enter image description here