Gnuplot设置数据标签的背景色

Gnuplot设置数据标签的背景色,gnuplot,Gnuplot,我想将数据标签的背景设置为白色!所考虑的图是以下数据(gnuDC.dat)的数据图: plot命令的内容如下: plot "gnuDC.dat" using 1:2 title "DC: GNU Fortran 4.7.2 + Open MPI 1.6.3" w p ls 1, \ "gnuDC.dat" using 1:2:3 with labels center offset 2.,0.7 font "Helvetica,14" tc ls 4 notitle, \ "gnuDC.dat

我想将数据标签的背景设置为白色!所考虑的图是以下数据(gnuDC.dat)的数据图:

plot命令的内容如下:

plot "gnuDC.dat" using 1:2 title "DC: GNU Fortran 4.7.2 + Open MPI 1.6.3" w p ls 1, \
 "gnuDC.dat" using 1:2:3 with labels center offset 2.,0.7 font "Helvetica,14" tc ls 4 notitle, \
 "gnuDC.dat" using 1:3 notitle smooth csplines ls 14
这给了我:

看起来还可以,但是如果标签背景是白色的话,你会觉得标签读得更好。有没有一种简单的方法可以一次为所有标签添加白色背景

以下是整个打印文件:

set terminal postscript eps size 14cm,10cm enhanced color \
        font 'Helvetica,18' linewidth 2

set output 'test.eps'

# Line style for axes
set style line 80 lt 0
set style line 80 lt rgb "#808080"

# Line style for grid
set style line 81 lt 3  # dashed
set style line 81 lt rgb "#808080" lw 0.5  # grey

set grid back linestyle 81
set border 3 back linestyle 80
set xtics nomirror
set ytics nomirror

set style line 100 lc rgb '#0060ad' lt 1 lw 2 pt 7 ps 1.5
set style line 200 lc rgb '#a2142f' lt 1 lw 2 pt 7 ps 1.5
set pointintervalbox 0

set style line 1 lc rgb '#0072bd' lt 1 lw 1 pt 9 pi -10 ps 2
set style line 2 lc rgb '#77ac30' lt 1 lw 1 pt 7 pi -10 ps 2
set style line 3 lc rgb '#d95319' lt 1 lw 1 pt 1 pi -10 ps 2

set bmargin 4
set lmargin 5
set rmargin 4

unset title
set size 1,1
#set origin 0,0.27
set xlabel "number of cores, -"
set ylabel "Computational time, s"

set key top right
set key spacing 1.5
set key width -12

set yrange [0:1710]

plot "gnuDC.dat" using 1:2 title "DC: GNU Fortran 4.7.2 + Open MPI 1.6.3" w p ls 1, \
     "gnuDC.dat" using 1:2:3 with labels center offset 2.,0.7 font "Helvetica,14" tc ls 4 notitle, \
     "gnuDC.dat" using 1:3 notitle smooth csplines ls 14

对于gnuplotversion5,有一个
boxed
选项,它正好做到了这一点:为标签提供背景,如果需要,还提供边框。样式由
设置样式文本框
控制,例如:

set style textbox opaque noborder
plot ... with labels boxed ...
应用于您的脚本(由于自5.0以来的破折号处理方式发生了更改,因此有一些小的更改):


不,对于4.6版和更早版本,没有一种简单的方法可以实现这一点。

这正是我所需要的!一个问题:为什么要将线型更改为线型。。。线条样式不再可用了吗?线条样式仍然可用,但我更喜欢线条样式。这是您更喜欢线条样式的原因,因为我一直在改进绘图的外观:)对于gnuplot版本5.0
set style line
,应该删除,但最终保留。如果我没有弄错的话,某些功能(如轮廓颜色等)只能通过更改线型来正确处理,而不能使用线样式(使用“设置样式增量用户”时也是如此)。由于gnuplot 5允许自定义线型的所有方面(虚线类型、宽度、颜色、点类型、点大小),我个人认为不再需要使用线型。但是请注意,线型不受
重置
的影响,但必须使用
重置会话
。这很有意义!谢谢!
set style textbox opaque noborder
plot ... with labels boxed ...
# Line style for axes

set style line 80 lt rgb "#808080"

# Line style for grid
set style line 81 dt 3  # dashed
set style line 81 lt rgb "#808080" lw 0.5  # grey

set grid back linestyle 81
set border 3 back linestyle 80
set tics nomirror

set linetype 1 lc rgb '#0072bd' pt 9 pi -10 ps 2 dt 3

set bmargin 4
set lmargin 5
set rmargin 4

set xlabel "number of cores, -"
set ylabel "Computational time, s"

set key top right
set key spacing 1.5
set key width -12
set yrange [0:1710]

set style textbox opaque noborder

plot "gnuDC.dat" using 1:2 title "DC: GNU Fortran 4.7.2 + Open MPI 1.6.3" w p lt 1, \
     "gnuDC.dat" using 1:2:3 with labels boxed center offset 2.,0.7 font "Helvetica,10" tc ls 1 notitle, \
     "gnuDC.dat" using 1:3 notitle smooth csplines lt 1