White background in gnuplot data points

85 views Asked by At

Dears helpers, I want to plot an errorbars on the top of my bar chart. So I used "with errorbars" option and set pointsize to 0.1 so that they will be very small. However, when I set pointsize less than 1, there is a white background like this:

The circle should be in blue or red, but it is white:

enter image description here

I used gnuplot on Windows, I have tried several versions from 5.4.5 to 5.4.8 but the problem is still unsolved.

Here is my gnuplot code:

$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

I have tried several versions from 5.4.5 to 5.4.8 but the problem is still unsolved.

2

There are 2 answers

0
Ethan On BEST ANSWER

The size of the white circle is controlled by set pointintervalbox. It can be reduced to zero by set pointintervalbox 0. This is quite hard to find in the documentation, but here are the relevant manual sections:

help yerrorbars

The yerrorbars (or errorbars) style is only relevant to 2D data plots. yerrorbars is like points, except that a vertical error bar is also drawn. At each point (x,y), a line is drawn from (x,y-ydelta) to (x,y+ydelta) or from (x,ylow) to (x,yhigh), depending on how many data columns are provided. The appearance of the tic mark at the ends of the bar is controlled by set errorbars. The clearance between the point and the error bars is controlled by set pointintervalbox.

help set pointintervalbox

The pointinterval and pointnumber properties of a line type are used only in plot style linespoints. A negative value of pointinterval or pointnumber, e.g. -N, means that before the selected set of point symbols are drawn a box (actually circle) behind each point symbol is blanked out by filling with the background color. The command set pointintervalbox controls the radius of this blanked-out region. It is a multiplier for the default radius, which is equal to the point size.

0
theozh On

As mentioned in the comments, this strange/undesired behaviour seems to be new for gnuplot>=5.4.4.

There is a simple workaround: instead of plotting style with errorbars use with vectors and if desired additionally with points. Check help arrowstyle and help vectors and the following script... which is your script with minor modifications.

Mind the lines:

set style arrow 1 heads size 0.1,90 fixed lc "black"

and

plot ... w vec as 1 ...

Script:

### errorbar without white background point (gnuplot>=4.5)
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 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::xtic(6) w labels rotate by 0 offset 0,0.7 font "Times,10"
### end of script

Result:

enter image description here