1
votes

I'm attempting to plot multiple xyerrorlines on a single Gnuplot 5.2 plot. I've discovered xyerrorlines inherits the errorbar line properties (linewidth, dashtype) for any line that has a title specified.

Do I have a syntax issue?

The attached MWE draws two simple lines - one with a title specified, and one without. You can see the one with notitle displays according to its own linewidth and dashtype, while the one with a title seems to inherit linewidth and dashtype from the "set errorbars" line (line 2).

set terminal windows color enhanced "Ariel" 8 close
set errorbars 5 linewidth 2 dashtype 1
set xrange[0:5]
set yrange[0:20]
set xlabel "X Values"
set ylabel "Y Values"

plot '-' with xyerrorlines linecolor rgbcolor "#B2B2B2" pointtype 2 pointsize 4 linewidth 4 dashtype 3 title 'Method 1',\
'-' with xyerrorlines linecolor rgbcolor "#000000" pointtype 2 pointsize 2 linewidth 4 dashtype 4 notitle
1   1   0.1 0.5
2   4   0.1 0.5
3   9   0.1 0.5
4   16  0.1 0.5
e
1   2   0.1 0.5
2   6   0.1 0.5
3   11  0.1 0.5
4   18  0.1 0.5
e

Which results in the following plot: Output of MWE

Removing the line:

set errorbars 5 linewidth 2 dashtype 1

Enables independent linewidth and dashtype settings for each line with a title, but the errorbars inherit those properties, which I don't want. I want to set separate line and dash styles for the errorbars and lines (as implied in the manual, page 128.)

This behavior is duplicated in the postscript terminal as well. I've not tested any other terminals.

I am using Gnuplot version 5.2 patch level 7.

Thank you, -Ryan

1

1 Answers

1
votes

The error seems to be triggered by a combination of non-blank title and plot style xyerrorlines. I don't think the setting of errorbar properties per se affects this. I will look into the underlying cause of the bug, but meanwhile here is a work-around:

$D1 << EOD
1   1   0.1 0.5
2   4   0.1 0.5
3   9   0.1 0.5
4   16  0.1 0.5
EOD
$D2 << EOD
1   2   0.1 0.5
2   6   0.1 0.5
3   11  0.1 0.5
4   18  0.1 0.5
EOD

set errorbars 5 linewidth 2 dashtype 1
plot $D1 with xyerrorlines lc rgbcolor "#B2B2B2" pt 2 ps 4 lw 4 dt 3 notitle,\
     $D2 with xyerrorlines lc rgbcolor "#000000" pt 2 ps 2 lw 4 dt 4 notitle, \
keyentry with xyerrorlines lc rgbcolor "#B2B2B2" pt 2 ps 4 lw 4 dt 3 title "Method 1",\
keyentry with xyerrorlines lc rgbcolor "#000000" pt 2 ps 2 lw 4 dt 4 title "Method 2"

The trick is to first plot the desired data with no title so that the bug is avoided, then create corresponding key entries using a title but no data. The "keyentry" plot component is relatively new but it is present in version 5.2.7.

enter image description here