这取决于您想如何显示相应的“标题”。让我们假设数据文件包含circles.dat
以下数据:
5 6.0 0.1 1
5 5.5 0.1 2
4 5.0 0.2 3
一个选项将绘制圆和使用第四列作为被放置在单独的圆心标签。这可以通过with labels
绘图风格为实现直接:
set terminal pngcairo
set output 'fig1.png'
fName = 'circles.dat'
unset key
set xr [3:6]
set yr [4:7]
set size square
set tics out nomirror
set xtics 3,1,6
set mxtics 2
set ytics 4,1,7
set mytics 2
plot \
fName u 1:2:3 w circles lc rgb 'red' lw 2, \
'' u 1:2:4 w labels tc rgb 'blue'
这将产生:
另外,人们可能希望把这些标签到图形的传说。或许有一个更好的解决方案,但是一种方法是 图中的数据文件的每一行分别与手动提取第四列(被用作密钥标题):
set terminal pngcairo
set output 'fig2.png'
fName = 'circles.dat'
unset key
set xr [3:6]
set yr [4:7]
set size square
set tics out nomirror
set xtics 3,1,6
set mxtics 2
set ytics 4,1,7
set mytics 2
set key top right reverse
stat fName nooutput
plot \
for [i=0:STATS_records-1] fName u 1:2:3 every ::i::i w circles t system(sprintf("awk 'NR==%d{print $4}' '%s'", i+1, fName))
这给出: