Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show median line on top of

Tags:

gnuplot

I have a handy script that is running ab and generating plot afterwards. However there is a problem, it shows me every point (which is good), however I would like to see also the average "line" between them. I will show more in the picture.

So is there any way to add the median/medium ranger on top?

Script

#!/usr/local/bin/gnuplot

set terminal jpeg size 1280,720
set size 1, 1
set output OUTPUT
set title OUTPUT
set key left top
set grid y
set xdata time
set timefmt "%s"
set format x "%S"
set xlabel 'seconds'
set ylabel "response time (ms)"
set datafile separator '\t'
plot INPUT every ::2 using 2:5 title 'response time' with points
exit

Ouptut

output

Output (what I would like to have)

output2

like image 690
Stan Avatar asked Oct 18 '22 12:10

Stan


1 Answers

That can be done with the smooth unique option:

This makes the data monotonic in x; points with the same x-value are replaced by a single point having the average y-value. The resulting points are then connected by straight line segments.

plot INPUT every ::2 using 2:5 title 'response time' with points,\
     '' every ::2 using 2:5 smooth unique title 'average' with lines
like image 105
Christoph Avatar answered Oct 21 '22 16:10

Christoph