Struggling to merge multiples charts in one and keeping it clear with Gnuplot - gnuplot

before I had four charts in Gnuplot to convey my information about my data. However, it was required for me to show everything in one unique chart since all charts are conveying related data but on different scales. For instance, for scale (8:8) I use X, scale (16:16) I use +, scale (8:16) I use square, and scale (8:24) I use a circle.
The problem that I stated is that it will become messy eventually and the chart will look very dirty in terms of readable. But, maybe, Gnuplot offers a better solution to me that I still don't know. Here is my Gnuplot code and the data files can be found here.
#!/usr/bin/gnuplot
reset session
set style line 1 lc rgb '#3274D9' lt 1 lw 1.0 ps 0.4 pt 2 pi 15 # auto-combiner input throughput - 8combines.8reducers
set style line 2 lc rgb '#3274D9' lt 1 lw 1.0 ps 0.4 pt 2 pi 15 # auto-combiner output throughput - 8combines.8reducers
set style line 3 lc rgb '#FF780A' lt 1 lw 1.0 ps 0.4 pt 2 pi 15 # static-combiner input throughput - 8combines.8reducers
set style line 4 lc rgb '#FF780A' lt 1 lw 1.0 ps 0.4 pt 2 pi 15 # static-combiner output throughput - 8combines.8reducers
set style line 5 lc rgb '#E02F44' lt 1 lw 1.0 ps 0.4 pt 2 pi 15 # no-combiner input throughput - 8combines.8reducers
set style line 6 lc rgb '#E02F44' lt 1 lw 1.0 ps 0.4 pt 2 pi 15 # no-combiner output throughput - 8combines.8reducers
set style line 7 lc rgb '#008000' lt 1 lw 1.0 ps 0.4 pt 2 pi 15 # auto-combiner average processing latency - 8combines.8reducers
set style line 8 lc rgb '#9ACD32' lt 1 lw 1.0 ps 0.4 pt 2 pi 15 # auto-combiner 99th percentile processing latency - 8combines.8reducers
set style line 9 lc rgb '#3274D9' lt 1 lw 1.0 ps 0.4 pt 1 pi 15 # auto-combiner input throughput - 16combines.16reducers
set style line 10 lc rgb '#3274D9' lt 1 lw 1.0 ps 0.4 pt 1 pi 15 # auto-combiner output throughput - 16combines.16reducers
set style line 11 lc rgb '#FF780A' lt 1 lw 1.0 ps 0.4 pt 1 pi 15 # static-combiner input throughput - 16combines.16reducers
set style line 12 lc rgb '#FF780A' lt 1 lw 1.0 ps 0.4 pt 1 pi 15 # static-combiner output throughput - 16combines.16reducers
set style line 13 lc rgb '#E02F44' lt 1 lw 1.0 ps 0.4 pt 1 pi 15 # no-combiner input throughput - 16combines.16reducers
set style line 14 lc rgb '#E02F44' lt 1 lw 1.0 ps 0.4 pt 1 pi 15 # no-combiner output throughput - 16combines.16reducers
set style line 15 lc rgb '#008000' lt 1 lw 1.0 ps 0.4 pt 1 pi 15 # auto-combiner average processing latency - 16reducers.8reducers
set style line 16 lc rgb '#9ACD32' lt 1 lw 1.0 ps 0.4 pt 1 pi 15 # auto-combiner 99th percentile processing latency - 16reducers.8reducers
set style line 17 lc rgb '#3274D9' lt 1 lw 1.0 ps 0.3 pt 5 pi 15 # auto-combiner input throughput - 8combines.16reducers
set style line 18 lc rgb '#3274D9' lt 1 lw 1.0 ps 0.3 pt 5 pi 15 # auto-combiner output throughput - 8combines.16reducers
set style line 19 lc rgb '#FF780A' lt 1 lw 1.0 ps 0.3 pt 5 pi 15 # static-combiner input throughput - 8combines.16reducers
set style line 20 lc rgb '#FF780A' lt 1 lw 1.0 ps 0.3 pt 5 pi 15 # static-combiner output throughput - 8combines.16reducers
set style line 21 lc rgb '#E02F44' lt 1 lw 1.0 ps 0.3 pt 5 pi 15 # no-combiner input throughput - 8combines.16reducers
set style line 22 lc rgb '#E02F44' lt 1 lw 1.0 ps 0.3 pt 5 pi 15 # no-combiner output throughput - 8combines.16reducers
set style line 23 lc rgb '#008000' lt 1 lw 1.0 ps 0.3 pt 5 pi 15 # auto-combiner average processing latency - 8combines.16reducers
set style line 24 lc rgb '#9ACD32' lt 1 lw 1.0 ps 0.3 pt 5 pi 15 # auto-combiner 99th percentile processing latency - 8combines.16reducers
set style line 25 lc rgb '#3274D9' lt 1 lw 1.0 ps 0.35 pt 7 pi 15 # auto-combiner input throughput - 8combines.24reducers
set style line 26 lc rgb '#3274D9' lt 1 lw 1.0 ps 0.35 pt 7 pi 15 # auto-combiner output throughput - 8combines.24reducers
set style line 27 lc rgb '#FF780A' lt 1 lw 1.0 ps 0.35 pt 7 pi 15 # static-combiner input throughput - 8combines.24reducers
set style line 28 lc rgb '#FF780A' lt 1 lw 1.0 ps 0.35 pt 7 pi 15 # static-combiner output throughput - 8combines.24reducers
set style line 29 lc rgb '#E02F44' lt 1 lw 1.0 ps 0.35 pt 7 pi 15 # no-combiner input throughput - 8combines.24reducers
set style line 30 lc rgb '#E02F44' lt 1 lw 1.0 ps 0.35 pt 7 pi 15 # no-combiner output throughput - 8combines.24reducers
set style line 31 lc rgb '#008000' lt 1 lw 1.0 ps 0.35 pt 7 pi 15 # auto-combiner average processing latency - 8combines.24reducers
set style line 32 lc rgb '#9ACD32' lt 1 lw 1.0 ps 0.35 pt 7 pi 15 # auto-combiner 99th percentile processing latency - 8combines.24reducers
set term pdfcairo size 5.0in,3.5in
set pointintervalbox 0
set datafile separator ','
set output "efficiency-throughput-networkbuffer-TaxiRideNYC-500K-merged.pdf"
set title "Efficiency evaluation: throughput vs. network buffer usage\nworkload of 500K rec/sec and different topologies" font ",16" offset 0,0.5,0
myTimeFmt = "%Y-%m-%d %H:%M:%S"
set xtics nomirror
set key under center maxrows 1 horizontal
set key font ",9"
set ylabel "Throughput (K rec/sec)" font ",10" #offset 1,0,0
set xtics font ",8" offset 0,0.5,0
set format x "%tH:%tM" time
set xlabel "time (hour:minute)" font ",10" offset 0,1,0
set xrange [0:5400]
set yrange [0:7]
set y2label "Combiner buffer usage" font ",10" #offset -1.5,0,0
set y2range [20:100]
set ytics nomirror font ",10"
set y2tics 0, 20 font ",10"
set format y2 "%g%%"
plot t=0 "throughput-vs-networkbuffer-500K-8combiners-8reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(6)) skip 2 notitle "auto-combiner avg. buffer usage (8:8)" with linespoints ls 7 axis x1y2 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-8reducers-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(6)/1000):(column(7)/1000) skip 2 title "auto-combiner avg. buffer usage (8:8)" with yerrorbars ls 7 axis x1y2 \
, t=0 "throughput-vs-networkbuffer-500K-16combiners-16reducers-static-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000) skip 2 notitle "static-combiner input throughput (16:16)" with linespoints ls 11 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-16combiners-16reducers-static-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000):(column(3)/1000) skip 2 title "static-combiner input throughput (16:16)" with yerrorbars ls 11 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-16reducers-static-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000) skip 2 notitle "static-combiner input throughput (8:16)" with linespoints ls 19 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-16reducers-static-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000):(column(3)/1000) skip 2 title "static-combiner input throughput (8:16)" with yerrorbars ls 19 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-24reducers-static-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000) skip 2 notitle "static-combiner input throughput (8:24)" with linespoints ls 27 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-24reducers-static-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000):(column(3)/1000) skip 2 title "static-combiner input throughput (8:24)" with yerrorbars ls 27 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-8reducers-static-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000) skip 2 notitle "static-combiner input throughput (8:8)" with linespoints ls 3 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-8reducers-static-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000):(column(3)/1000) skip 2 title "static-combiner input throughput (8:8)" with yerrorbars ls 3 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-16reducers-no-combiner-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(4)/1000) skip 2 notitle "no-combiner input throughput (8:16)" with linespoints ls 21 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-16reducers-no-combiner-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(4)/1000):(column(5)/1000) skip 2 title "no-combiner input throughput (8:16)" with yerrorbars ls 21 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-16combiners-16reducers-no-combiner-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(4)/1000) skip 2 notitle "no-combiner throughput (16:16)" with linespoints ls 13 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-16combiners-16reducers-no-combiner-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(4)/1000):(column(5)/1000) skip 2 title "no-combiner throughput (16:16)" with yerrorbars ls 13 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-24reducers-no-combiner-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(4)/1000) skip 2 notitle "no-combiner input throughput (8:24)" with linespoints ls 29 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-24reducers-no-combiner-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(4)/1000):(column(5)/1000) skip 2 title "no-combiner input throughput (8:24)" with yerrorbars ls 29 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-8reducers-no-combiner-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(4)/1000) skip 2 notitle "no-combiner throughput (8:8)" with linespoints ls 5 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-8reducers-no-combiner-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(4)/1000):(column(5)/1000) skip 2 title "no-combiner throughput (8:8)" with yerrorbars ls 5 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-16combiners-16reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000) skip 2 notitle "auto-combiner input throughput (16:16)" with linespoints ls 9 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-16combiners-16reducers-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000):(column(3)/1000) skip 2 title "auto-combiner input throughput (16:16)" with yerrorbars ls 9 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-8reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000) skip 2 notitle "auto-combiner input throughput (8:8)" with linespoints ls 1 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-8reducers-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000):(column(3)/1000) skip 2 title "auto-combiner input throughput (8:8)" with yerrorbars ls 1 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-16reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000) skip 2 notitle "auto-combiner input throughput (8:16)" with linespoints ls 17 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-16reducers-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000):(column(3)/1000) skip 2 title "auto-combiner input throughput (8:16)" with yerrorbars ls 17 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-24reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000) skip 2 notitle "auto-combiner input throughput (8:24)" with linespoints ls 25 axis x1y1 \
, t=0 "throughput-vs-networkbuffer-500K-8combiners-24reducers-all.csv" every 10 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000):(column(3)/1000) skip 2 title "auto-combiner input throughput (8:24)" with yerrorbars ls 25 axis x1y1 \
The first thing that I would ask is to merge the legends into groups of X, +, squares, and circles. However, I think that the chart is still a big mess. How would one show all information that I have in a clear way using only one chart? I think I will probably have to remove some lines in the end. But I would like to know other alternatives before going to it.
thanks for your suggestions!

I ended up using the fence plot constructed with separate parametric surfaces of Gnuplot 3D with splot available here.

Related

How to stack impulses in Gnuplot?

I am using Gnuplot to show the precipitation measured during the last 13 monthts. Data is read from two data files, rain.dat and snow.dat. I use impulses, but on days with both rain and snow the impulses are plotted over each other. It had been better if the impulses were stacked.
#!/usr/bin/gnuplot -persist
set xdata time
set timefmt "%d.%m.%Y"
set ylabel "Precipitation (mm)"
set xrange ["01.`date --date="1 year ago" +%m.%Y`":"01`date --date="1 month" +.%m.%Y`"]
set xtics "01.`date --date="1 year ago" +%m.%Y`",2800000, \
"01.`date --date="now 1 month" +%m.%Y`" offset 3,0.2
set format x "%b"
set style line 100 lt 3 lc rgb "gray" lw 0.5
set style line 101 lt 3 lc rgb "gray" lw 0.5
set grid back xtics ytics mytics ls 100, ls 100, ls 101
set terminal png size 1000,200
set output 'precipitation.png'
plot 'rain.dat' using 1:2 title 'Rain' w impulses lt rgb '#ff0000' lw 4 , \
'snow.dat' using 1:2 title 'Snow' w impulses lt rgb '#0000ff' lw 2
rain.dat:
16.02.2021 8
22.02.2021 6
04.03.2021 10
08.03.2021 13
14.03.2021 5
snow.dat:
19.02.2021 19
22.02.2021 10
04.03.2021 14
12.03.2021 8
How can impulses be stacked with Gnuplot?
As #Ethan already mentioned, with impulses will always start at 0. If you don't mind some little extra effort, you can mimic "stacking" impulses if you first plot the sum of rain and snow with the "snow color", and then plot rain alone with the "rain color" on top of it.
But how do you get the sum of rain and snow?
plot your datablocks (or files) into the temporary datablock $Temp.
plot datablock $Temp into the datablock $SnowAndRain using the option smooth frequency which sums up snow and rain for each day. Check help smooth.
Script: (works for gnuplot>=5.2.0, Sept. 2017)
### "stacked" impulses
reset session
$Rain <<EOD
16.02.2021 8
22.02.2021 6
04.03.2021 10
08.03.2021 13
14.03.2021 5
EOD
$Snow <<EOD
19.02.2021 19
22.02.2021 10
04.03.2021 14
12.03.2021 8
EOD
myTimeFmt = "%d.%m.%Y"
set table $Temp
plot $Snow u (sprintf("%.0f",timecolumn(1,myTimeFmt))):2 w table
plot $Rain u (sprintf("%.0f",timecolumn(1,myTimeFmt))):2 w table
set table $SnowAndRain
set format x "%.0f"
plot $Temp u 1:2 smooth freq
unset table
set format x "%d %b" timedate
plot $SnowAndRain u 1:2 w impulses lw 4 lc "blue" title 'Snow', \
$Rain u (timecolumn(1,myTimeFmt)):2 w impulses lc "red" lw 4 title 'Rain', \
### end of script
Result:
Addition:
A bit more cumbersome solution which seem to work with gnuplot 5.0.0 (at least with Win10). I hope somebody can simplify this.
Script: (tested with Win10 gnuplot 5.0.0. Same result as above)
### "stacked" impulses (should work with gnuplot 5.0.0)
reset session
$Rain <<EOD
16.02.2021 8
22.02.2021 6
04.03.2021 10
08.03.2021 13
14.03.2021 5
EOD
$Snow <<EOD
19.02.2021 19
22.02.2021 10
04.03.2021 14
12.03.2021 8
EOD
myTimeFmt = "%d.%m.%Y"
set table $Temp
plot $Snow u (t=timecolumn(1,myTimeFmt)/1e5,int(t)):2:((t-int(t))*1e5) w table
plot $Rain u (t=timecolumn(1,myTimeFmt)/1e5,int(t)):2:((t-int(t))*1e5) w table
unset table
set table $SnowAndRain
set format x "%.0f"
plot $Temp u ($1*1e5+$3):2 smooth freq
unset table
set format x "%d %b" timedate
plot $SnowAndRain u 1:2 w impulses lw 4 lc "blue" title 'Snow', \
$Rain u (timecolumn(1,myTimeFmt)):2 w impulses lc "red" lw 4 title 'Rain'
### end of script
Impulses cannot be stacked. By definition they extend from y=0 to some non-zero y value.
If the two data sets were sampled at the same set of x coordinates then you could use the stacked histogram plot mode, but that isn't the case here.
How about back-to-back impulses rather than stacked impulses?
$RAIN << EOD
16.02.2021 8
22.02.2021 6
04.03.2021 10
08.03.2021 13
14.03.2021 5
EOD
$SNOW << EOD
19.02.2021 19
22.02.2021 10
04.03.2021 14
12.03.2021 8
EOD
set xzeroaxis
plot $RAIN using 1:2 with impulse lw 3, \
$SNOW using 1:(-$2) with impulse lw 3
I have tried to make a simplification to #theozh's answer, but some of the pulses are slightly displaced in time. #theozh has a much better solution of my problem.
reset session
$Rain <<EOD
16.02.2021 8
22.02.2021 6
04.03.2021 10
08.03.2021 13
14.03.2021 5
EOD
$Snow <<EOD
19.02.2021 19
22.02.2021 10
04.03.2021 14
12.03.2021 8
EOD
myTimeFmt = "%d.%m.%Y"
set table $Temp
plot $Snow u (timecolumn(1,myTimeFmt)):2 w table
plot $Rain u (timecolumn(1,myTimeFmt)):2 w table
unset table
set table $SnowAndRain
plot $Temp u 1:2 smooth freq
unset table
set format x "%d %b" timedate
plot $SnowAndRain u 1:2 w impulses lw 4 lc "blue" title 'Snow', \
$Rain u (timecolumn(1,myTimeFmt)):2 w impulses lc "red" lw 4 title 'Rain', \
### end of code
Addition:
The rain and snow pulses are drawn on top of each other if $Rain is written to table $RainTemp using (timecolumn(1,myTimeFmt)):2 before plotting the the graph. But still the timing is bit incorrect.
reset session
$Rain <<EOD
16.02.2021 8
22.02.2021 6
04.03.2021 10
08.03.2021 13
14.03.2021 5
EOD
$Snow <<EOD
19.02.2021 19
22.02.2021 10
04.03.2021 14
12.03.2021 8
EOD
myTimeFmt = "%d.%m.%Y"
set table $Temp
plot $Snow u (timecolumn(1,myTimeFmt)):2 w table
plot $Rain u (timecolumn(1,myTimeFmt)):2 w table
unset table
set table $SnowAndRain
plot $Temp u 1:2 smooth freq
unset table
set table $RainTemp
plot $Rain u (timecolumn(1,myTimeFmt)):2 w table
unset table
set format x "%d %b" timedate
plot $SnowAndRain u 1:2 w impulses lw 4 lc "blue" title 'Snow', \
$RainTemp u 1:2 w impulses lw 4 lc "red" title 'Rain'

How to plot only max values for yerrorbars in Gnuplot?

I have this plot where I show the average values and the standard deviation. The problem is that there is a high +/- error on some lines and I would like to show only the max values for the standard deviation. So the plot can be more clear. Now I am using linespoints and yerrorbars and the plot looks like below:
As you can see the orange and green lines vary a lot. I would like to show only the max values for them so the plot becomes more clear. The script that I am using is below:
plot \
t=0 "throughput-vs-networkbuffer-500K-8reducers-all.csv" every 30 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(8)) skip 2 notitle "no pre-agg" with linespoints lc rgb '#E02F44' lt 1 lw 1.0 ps 0.7 pt 2 pi 30 axis x1y1 \
,t=0 "throughput-vs-networkbuffer-500K-8reducers-all.csv" every 30 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(8)):(column(9)) skip 2 title "no pre-agg" with yerrorbars lc rgb '#E02F44' lt 1 lw 1.0 ps 0.7 pt 2 pi 30 axis x1y1 \
,t=0 "netBuffer-20K-200K-20K-8local-8global-onephase-all.csv" every 28 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)) skip 2 notitle "local mini-batch" with linespoints lc rgb '#008000' lt 1 lw 1.0 ps 0.6 pt 6 pi 28 axis x1y1 \
,t=0 "netBuffer-20K-200K-20K-8local-8global-onephase-all.csv" every 28 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)):(column(3)) skip 2 title "local mini-batch" with yerrorbars lc rgb '#008000' lt 1 lw 1.0 ps 0.6 pt 6 pi 28 axis x1y1 \
,t=0 "netBuffer-20K-200K-20K-8local-8global-twophase-all.csv" every 26 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)) skip 2 notitle "local agg 2-phases" with linespoints lc rgb '#FF780A' lt 1 lw 1.0 ps 0.6 pt 8 pi 26 axis x1y1 \
,t=0 "netBuffer-20K-200K-20K-8local-8global-twophase-all.csv" every 26 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)):(column(3)) skip 2 title "local agg 2-phases" with yerrorbars lc rgb '#FF780A' lt 1 lw 1.0 ps 0.6 pt 8 pi 26 axis x1y1 \
,t=0 "netBuffer-vs-latency-20K-200K-20K-8adcom-8reducers-all.csv" every 24 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(4)) skip 2 notitle "AdCom pre-agg" with linespoints lc rgb '#3274D9' lt 1 lw 1.0 ps 0.6 pt 5 pi 24 axis x1y1 \
,t=0 "netBuffer-vs-latency-20K-200K-20K-8adcom-8reducers-all.csv" every 24 u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(4)):(column(3)) skip 2 title "AdCom pre-agg" with yerrorbars lc rgb '#3274D9' lt 1 lw 1.0 ps 0.6 pt 5 pi 24 axis x1y1 \
I improved it by adding 4 columns where the third is only the average and the fourth is the average + the standard deviation:
X:(column(2)):(column(2)):(column(2) + column(3))
However, if there is a way more elegant to do it I appreciate any help!
Here is a minimal example for half an error bar using with vectors and set style arrow.
Although, I'm not sure whether it is "experimentally acceptable" to just display "half" an error bar.
Code:
### "half" yerrorbars
reset session
$Data <<EOD
# x y yerr
1 0.10 0.05
2 0.20 0.10
3 0.45 0.21
4 0.67 0.28
5 0.44 0.11
EOD
unset key
set xrange[0:6]
set style arrow 1 size 0.1,90 lc "red"
plot $Data u 1:2 w lp pt 7, \
'' u 1:2:(0):3 w vectors as 1
### end of code
Result:

Linked top x-axis in Gnuplot

My test.dat file is given below
6.78E-01 -1.907881356 -1.938152542 -1.994762712 -4.409491525 -3.707118644 -2.623559322 -1.903389831 -1.891452492 -1.880469492 -2.009079661 -1.835169492 -2.193627119
6.73E-01 -1.828333333 -1.861727273 -1.916205387 -4.308956229 -3.614276094 -2.547508418 -1.823097643 -1.811922731 -1.800939731 -1.930919529 -1.757255892 -2.114855219
6.69E-01 -1.749849498 -1.786324415 -1.838698997 -4.209765886 -3.522675585 -2.472474916 -1.743879599 -1.733456913 -1.722473913 -1.853805017 -1.680384615 -2.037137124
6.64E-01 -1.672408638 -1.711923588 -1.762222591 -4.111893688 -3.432292359 -2.398438538 -1.665714286 -1.656033831 -1.645050831 -1.777715282 -1.604534884 -1.960451827
6.60E-01 -1.595990099 -1.63850495 -1.686755776 -4.015313531 -3.34310231 -2.325379538 -1.588580858 -1.579632835 -1.568649835 -1.702630033 -1.529686469 -1.884778878
6.56E-01 -1.52057377 -1.56604918 -1.612278689 -3.92 -3.255081967 -2.253278689 -1.512459016 -1.50423382 -1.49325082 -1.628529508 -1.455819672 -1.810098361
6.51E-01 -1.446140065 -1.494537459 -1.538771987 -3.825928339 -3.168208469 -2.182117264 -1.43732899 -1.429817202 -1.418834202 -1.555394463 -1.382915309 -1.736390879
6.47E-01 -1.372669903 -1.423951456 -1.466216828 -3.733074434 -3.082459547 -2.111877023 -1.363171521 -1.356363906 -1.345380906 -1.483206149 -1.310954693 -1.66363754
6.43E-01 -1.300144695 -1.354273312 -1.394594855 -3.641414791 -2.997813505 -2.042540193 -1.289967846 -1.283855347 -1.272872347 -1.411946302 -1.239919614 -1.591819936
6.39E-01 -1.228546326 -1.285485623 -1.323888179 -3.550926518 -2.914249201 -1.974089457 -1.217699681 -1.212273415 -1.201290415 -1.341597125 -1.169792332 -1.520920128
6.35E-01 -1.157857143 -1.217571429 -1.254079365 -3.461587302 -2.831746032 -1.906507937 -1.146349206 -1.14160046 -1.13061746 -1.27214127 -1.100555556 -1.450920635
6.31E-01 -1.088059937 -1.150514196 -1.18515142 -3.373375394 -2.750283912 -1.83977918 -1.075899054 -1.071819278 -1.060836278 -1.20356183 -1.032192429 -1.381804416
6.27E-01 -1.019137931 -1.084297806 -1.117087774 -3.286269592 -2.66984326 -1.773887147 -1.006332288 -1.002913094 -0.991930094 -1.13584232 -0.96468652 -1.313554859
6.23E-01 -0.951074766 -1.018906542 -1.049872274 -3.200249221 -2.590404984 -1.708816199 -0.937632399 -0.934865555 -0.923882555 -1.068966667 -0.898021807 -1.246155763
6.19E-01 -0.883854489 -0.954325077 -0.983489164 -3.115294118 -2.511950464 -1.644551084 -0.869783282 -0.867660709 -0.856677709 -1.002919195 -0.832182663 -1.179591331
6.15E-01 -0.817461538 -0.890538462 -0.917923077 -3.031384615 -2.434461538 -1.581076923 -0.802769231 -0.801283 -0.7903 -0.937684615 -0.767153846 -1.113846154
6.12E-01 -0.751880734 -0.82753211 -0.853159021 -2.948501529 -2.357920489 -1.518379205 -0.736574924 -0.735717251 -0.724734251 -0.873248012 -0.702920489 -1.048905199
6.08E-01 -0.687097264 -0.765291793 -0.789182371 -2.86662614 -2.28231003 -1.456443769 -0.67118541 -0.670948653 -0.659965653 -0.809594833 -0.639468085 -0.984753799
6.04E-01 -0.623096677 -0.703803625 -0.725978852 -2.785740181 -2.207613293 -1.395256798 -0.606586103 -0.606962758 -0.595979758 -0.746710876 -0.576782477 -0.921377644
I use the following code in gnuplot to check the plot
set terminal postscript eps enhanced colour font 'Times-Roman,12' size 6in,5in
set output "Plot1.eps"
set xtics out scale 1.5
set ytics out scale 1.5
set tics font ", 16"
set xlabel "10^{3}{/Symbol \264} 1/T (K^{-1})" font ",16"
set ylabel "log&{t}{/Times-Italic p}_{Pu({/Times-Italic g}),Pa} " font ",16"
set key outside right top
set key maxrows 12 spacing 2.1 font ",16" width -2
plot [0.60:0.70] 'test.dat.dat' u 1:2 with points pt 1 ps 1.75 lt rgb "red" title "Maeda {/Times-Italic et al.} [7]", \
'' u 1:3 with points pt 1 ps 1.75 lt rgb "blue" title "Pu-20Zr [7]", \
'' u 1:4 with points pt 1 ps 1.75 lt rgb "dark-green" title "Pu-50Zr [7]", \
'' u 1:5 with points pt 2 ps 1.75 lt -1 title "Present work", \
'' u 1:6 with points pt 3 ps 1.75 lt -1 title "Present work", \
'' u 1:7 with points pt 4 ps 1.75 lt rgb "red" title "Alcock [16]", \
'' u 1:8 with points pt 4 ps 1.75 lt rgb "blue" title "Phipps {/Times-Italic et al.} [19]", \
'' u 1:9 with points pt 4 ps 1.75 lt rgb "dark-green" title "Mulford [20]", \
'' u 1:10 with points pt 5 ps 1.75 lt rgb "blue" title "Kent [21]", \
'' u 1:11 with points pt 5 ps 1.75 lt rgb "red" title "Ackermann and Rauh [22]", \
'' u 1:12 with points pt 5 ps 1.75 lt rgb "dark-green" title "Bradbury and Ohse [23]", \
'' u 1:13 with points pt 5 ps 1.75 lt -1 title "Kim and Hofman [24]"
The code runs well. One can see that x axis is related to temperature as 1000/temperature. Now I wanted a linked top x2-axis with temperature in K. So, for example, xrange is from 0.6 to 0.7. Then x2 axis should be from 1000/0.6 to 1000/0.7 i.e. from 1666.67 K to 1428.57 K. So I modified the code based on linkedaxes.dem.
set terminal postscript eps enhanced colour font 'Times-Roman,12' size 6in,5in
set output "Plot2.eps"
set xtics out scale 1.5
set ytics out scale 1.5
set tics font ", 16"
set xtics nomirror
set xlabel "10^{3}{/Symbol \264} 1/T (K^{-1})" font ",16"
set ylabel "log&{t}{/Times-Italic p}_{Pu({/Times-Italic g}),Pa} " font ",16"
set key outside right top
set key maxrows 12 spacing 2.1 font ",16" width -2
set link x2 via 1000./x inverse 1000./x
set x2tics out scale 1.5
set x2label "Temperature (K)" font ",16"
plot [0.60:0.70] 'test.dat' u 1:2 with points pt 1 ps 1.75 lt rgb "red" title "Maeda {/Times-Italic et al.} [7]", \
'' u 1:3 with points pt 1 ps 1.75 lt rgb "blue" title "Pu-20Zr [7]", \
'' u 1:4 with points pt 1 ps 1.75 lt rgb "dark-green" title "Pu-50Zr [7]", \
'' u 1:5 with points pt 2 ps 1.75 lt -1 title "Present work ", \
'' u 1:6 with points pt 3 ps 1.75 lt -1 title "Present work", \
'' u 1:7 with points pt 4 ps 1.75 lt rgb "red" title "Alcock [16]", \
'' u 1:8 with points pt 4 ps 1.75 lt rgb "blue" title "Phipps {/Times-Italic et al.} [19]", \
'' u 1:9 with points pt 4 ps 1.75 lt rgb "dark-green" title "Mulford [20]", \
'' u 1:10 with points pt 5 ps 1.75 lt rgb "blue" title "Kent [21]", \
'' u 1:11 with points pt 5 ps 1.75 lt rgb "red" title "Ackermann and Rauh [22]", \
'' u 1:12 with points pt 5 ps 1.75 lt rgb "dark-green" title "Bradbury and Ohse [23]", \
'' u 1:13 with points pt 5 ps 1.75 lt -1 title "Kim and Hofman [24]"
But the set link does not give the computed values on the top x2 axis. What modifications in code need to be made?
It looks like for some reason (which I don't know) you have to give an increment for the x2tics.
Try the following minimal example:
Code:
### link x2 axis
reset session
set xrange[0.6:0.7]
set xtics nomirror
set link x2 via 1000./x inverse 1000./x
set x2tics 50
plot x
### end of code
Result:

Gnuplot set background color of data label

I want to set the background of data labels to white! The considered plot is a data plot of the following data (gnuDC.dat):
4 1570.96 1571
8 770.63 771
12 530.33 530
16 385.13 385
24 261.87 262
48 137.71 138
96 81.42 81
The plot command reads:
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
Which gives me:
It looks ok but think one could read the lables better when the would have an white background. Is there an easy way to add the white background for all labels at once?
Here is the whole print file:
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
With gnuplot version 5 there is a boxed option which does exactly this: give labels a background and, if you want, also a border. The style is controlled with set style textbox, e.g.
set style textbox opaque noborder
plot ... with labels boxed ...
Applied to your script (with some minor changes due to the changed dash handling since 5.0):
# 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
No, for versions 4.6 and earlier there isn't an easy way to achieve this.

Gnuplot is not ploting anymore

I have a script to plot a graph with gnuplot. Last manth this script was ploting with no errors. I didn't make any modification but now it is not ploting anymore. I did all steps on this web site but still don't work. http://www.gnuplot.info/faq/faq.html#SECTION00092000000000000000
Does anybody have an idea of what is happening?
Thanks!
#!/usr/bin/gnuplot
reset
set grid
set title 'Desempenho do BTRIM com peers de reputação condicionada'
set xlabel 'Tempo'
set ylabel 'Vazão - downloads completos / tempo'
set style line 1 lc rgb '#0060ad' lt 1 lw 2 pi -1 ps 1.0
set style line 2 lc rgb '#dd181f' lt 1 lw 2 pi -1 ps 1.0
set style line 3 lc rgb '#29c524' lt 1 lw 2 pi -1 ps 1.0
set style line 4 lc rgb '#7D72F9' lt 1 lw 2 pi -1 ps 1.0
set style line 5 lc rgb '#000000' lt 1 lw 2 pi -1 ps 1.0
set pointintervalbox 0
plot '<paste ../00/Statistic100.txt ../01/Statistic100.txt ../02/Statistic100.txt ../03/Statistic100.txt ../04/Statistic100.txt ../05/Statistic100.txt ../06/Statistic100.txt ../07/Statistic100.txt ../08/Statistic100.txt ../09/Statistic100.txt' smooth unique with linespoint lt 5 lw 1 title 'Reputação de 100%', \
'<paste ../00/Statistic75.txt ../01/Statistic75.txt ../02/Statistic75.txt ../03/Statistic75.txt ../04/Statistic75.txt ../05/Statistic75.txt ../06/Statistic75.txt ../07/Statistic75.txt ../08/Statistic75.txt ../09/Statistic75.txt' smooth unique with linespoint lt 6 lw 1 title 'Reputação de 75%', \
'<paste ../00/Statistic50.txt ../01/Statistic50.txt ../02/Statistic50.txt ../03/Statistic50.txt ../04/Statistic50.txt ../05/Statistic50.txt ../06/Statistic50.txt ../07/Statistic50.txt ../08/Statistic50.txt ../09/Statistic50.txt' smooth unique with linespoint lt 7 lw 1 title 'Reputação de 50%', \
'<paste ../00/Statistic25.txt ../01/Statistic25.txt ../02/Statistic25.txt ../03/Statistic25.txt ../04/Statistic25.txt ../05/Statistic25.txt ../06/Statistic25.txt ../07/Statistic25.txt ../08/Statistic25.txt ../09/Statistic25.txt' smooth unique with linespoint lt 8 lw 1 title 'Reputação de 25%'
pause -1

Resources