Search code examples
gnuplot

How do I use yerror or yerrorbar together with linespoints and other parameters in gnuplot?


I can plot my chart using the regular values of average. Then I added a new column for each average that is the standard deviation. My data is something like this:

time,throughputINmean,throughputINstddev,throughputOUTmean,throughputOUTstddev,latency50mean,latency50stddev,latency99mean,latency99stddev
,0,0,0,0,0,0,0,0
"2020-06-08 09:43:45",0,0,0,0,0,0,0.862083,0.195044
"2020-06-08 09:44:00",1385.41,155.736,1385.41,155.737,0,0,0,0
"2020-06-08 09:44:15",1878.42,28.5521,1878.42,28.5521,0,0,0,0
"2020-06-08 09:44:30",2271.56,29.6025,2271.56,29.608,0,0,0,0
"2020-06-08 09:44:45",2642.69,49.2259,2642.69,49.2284,0,0,0,0
"2020-06-08 09:45:00",1627.49,99.2306,1627.49,99.232,0,0,0,0
"2020-06-08 09:45:15",1498.38,44.8282,1498.38,44.8282,0,0,0,0
"2020-06-08 09:45:30",1462.4,18.8785,1462.39,18.8717,0,0,0,0

I plot using this script in gnuplot:

plot t=0 "throughput-vs-latency-50K-8combiners-8reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000) skip 2 notitle with linespoints ls 1 axis x1y1 \
, t=0 "throughput-vs-latency-50K-8combiners-8reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(4)/1000) skip 2 notitle with linespoints ls 2 axis x1y1 \
, t=0 "throughput-vs-latency-50K-8combiners-8reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(6)/1000) skip 2 notitle with linespoints ls 3 axis x1y2 \
, t=0 "throughput-vs-latency-50K-8combiners-8reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(8)/1000) skip 2 notitle with linespoints ls 4 axis x1y2 \

then I just added on the last line the yerror parameter and the columns regarding these values. The last line became this:

, t=0 "throughput-vs-latency-50K-8combiners-8reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(8)/1000):((column(8)/1000)-(column(9)/1000)):((column(8)/1000)+(column(9)/1000)) skip 2 notitle with yerror linespoints ls 4 axis x1y2

But Gnuplot complains that this is not a recognized token. I also tested with yerrorbars and I am getting the same error.


Solution

  • "with yerrorlines", "with yerrorbars" and "with linespoints" are three different plot styles. You cannot choose two at the same time. So if you want to switch the plot to "yerrorlines" you must remove the keyword "linespoints".