亲爱的帮手们: 我想在条形图的顶部绘制误差线。所以我使用了“with errorbars”选项并将pointsize设置为0.1,这样它们就会非常小。然而,当我设置pointsize小于1时,就会出现这样的白色背景:
圆圈应该是蓝色或红色,但它是白色的:
我在Windows上使用gnuplot,我尝试了从5.4.5到5.4.8的几个版本,但问题仍然没有解决。
这是我的 gnuplot 代码:
$data1 << EOD
#Plan_1 Plan2
#50.4/28 50.25
49.8523456 49.49061091 2.49261728 2.474530546 0.005
44.15166667 43.608 2.207583333 2.1804 <0.005
53.68666667 53.492 2.684333333 2.6746 0.005
52.57555556 52.263 2.628777778 2.61315 0.005
45.48722222 45.53 2.274361111 2.2765 0.005
52.87444444 52.539 2.643722222 2.62695 0.005
45.27277778 45.275 2.263638889 2.26375 0.005
50.98 50.384 2.549 2.5192 0.005
EOD
set term wxt 0 enhanced
set encoding utf8
set lmargin 10
set bmargin 5
set tics font 'Arial,16'
set xlabel 'DVH parameters' font 'Arial,16' offset 0,-1
set ylabel 'Dose (Gy)' font 'Arial,16' offset -2,0
width=0.3
set title 'PTV_{45}' font 'Arial,16'
set boxwidth width
set style data histogram
set style fill solid
set style histogram cluster gap 1
set xtic scale 0
set auto x
set key font 'Arial,16'
set yrange [30:75]
set xrange [-1:8]
set xtics ('D_{mean}' 0,'D_{min}' 1,'D_{max}' 2,'D_{5}' 3,'D_{95}' 4,'D_{2}' 5,'D_{98}' 6,'D_{50}' 7)
set bars 2
plot $data1 u ($0-width/2):1 w boxes lc 3 t '50.4/28',\
$data1 u ($0+width/2):2 w boxes lc 7 t '50/25',\
$data1 u ($0-width/2):($1-5):($3) w errorbars pt 7 ps 0.1 lc 8 notitle,\
$data1 u ($0+width/2):2:($4) w errorbars pt 1 ps 0.1 lc 8 notitle,\
$data1 u 0:($1+4):5 w labels rotate by 0 font "Times,10" notitle
我尝试了从5.4.5到5.4.8的几个版本,但问题仍然没有解决。
正如评论中提到的,这种奇怪/不受欢迎的行为对于 gnuplot>=5.4.4 来说似乎是新的。
有一个简单的解决方法:使用
with errorbars
代替绘图样式 with vectors
,如果需要,还可以使用 with points
。检查 help arrowstyle
和 help vectors
以及以下脚本...这是您的脚本,经过细微修改。
注意台词:
set style arrow 1 heads size 0.1,90 fixed lc "black"
和
plot ... w vec as 1 ...
脚本:
### errorbar without white background point (gnuplot>=5.4.4)
reset session
$data1 << EOD
#Plan_1 Plan2
#50.4/28 50.25
49.8523456 49.49061091 2.49261728 2.474530546 0.005 D_{mean}
44.15166667 43.608 2.207583333 2.1804 <0.005 D_{min}
53.68666667 53.492 2.684333333 2.6746 0.005 D_{max}
52.57555556 52.263 2.628777778 2.61315 0.005 D_{5}
45.48722222 45.53 2.274361111 2.2765 0.005 D_{95}
52.87444444 52.539 2.643722222 2.62695 0.005 D_{2}
45.27277778 45.275 2.263638889 2.26375 0.005 D_{98}
50.98 50.384 2.549 2.5192 0.005 D_{50}
EOD
set term wxt 0 enhanced
set encoding utf8
set lmargin 10
set bmargin 5
set tics font 'Arial,16'
set xlabel 'DVH parameters' font 'Arial,16' offset 0,-1
set ylabel 'Dose (Gy)' font 'Arial,16' offset -2,0
width=0.3
set title 'PTV_{45}' font 'Arial,16'
set boxwidth width
set style data histogram
set style fill solid
set style histogram cluster gap 1
set xtic scale 0
set auto x
set key font 'Arial,16'
set yrange [30:75]
set xrange [-1:8]
set bars 2
set key noautotitle
set style arrow 1 heads size 0.1,90 fixed lc "black"
plot $data1 u ($0-width/2):1:xtic(6) w boxes lc 3 t '50.4/28',\
'' u ($0+width/2):2 w boxes lc 7 t '50/25',\
'' u ($0-width/2):($1-$3):(0):($3*2) w vec as 1,\
'' u ($0-width/2):1:3 w p pt 7 ps 0.5 lc "black",\
'' u ($0+width/2):($2-$4):(0):($4*2) w vec as 1,\
'' u ($0+width/2):2:4 w p pt 7 ps 0.5 lc "black",\
'' u 0:($1+$3):5 w labels rotate by 0 offset 0,0.7 font "Times,10"
### end of script
结果: