4

I'm comparing the throughput of wireless link in two situations, i want to plot them both in a single graph. the problem is that the graph obtained by plotting throughput against time is as in this picture

first graph

when i plot both throughputs in the same graph i obtain something as in this second picture second graph it is not clear to differentiate between the two.

I've used this code below for plotting a single throughput graph

#!/usr/bin/gnuplot

reset

!iperf -c 192.168.1.101 -i 0.5 -t 60 > a

#this is used for deleting first 6 lines 
!sed -i 1,+5d a

#used to delete last line
!sed '$d' a > cropped

!cat cropped | cut -c 7-10 > b
!cat cropped | cut -c 35-38 > c
!paste b c > d

!awk 'BEGIN{print "0.0  0.0"}{print}' d > e

set xlabel "time"
set ylabel "throughput"

set terminal png nocrop enhanced font arial 8 size 900,300
#set terminal png size 900, 300

set output "chart_1.png"

#table name below graph(naming curve by colour)
set key below

plot  'e' using 1:2 title "Throughput Performance" with lines

below is the code which i have used for plotting both graphs

#!/usr/bin/gnuplot

reset



set xlabel "time"
set ylabel "throughput"


set terminal png nocrop enhanced font arial 8 size 900,300
#set terminal png size 900, 300

set output "chart_1.png"


#table name below graph(naming curve by colour)
set key below



set style data linespoints

plot "1" using 1:2 title "case1", \
     "2" using 1:2 title "case2"

output looks like this: enter image description here

Shashank
  • 75
  • 6
  • where's the code for the "both" version? – Karoly Horvath Apr 27 '14 at 17:44
  • Two general tips: use the `pngcairo` terminal if you need a pixel-based format and plot `with lines` (the two graphs together were plot `with linespoints`, or one only `with points`). And, the visualization depends on what you want to emphasize. You could also draw two graphs one above the other with `set multiplot layout 2,1`, mark some regions of special interest, indlude a grid etc. – Christoph Apr 27 '14 at 17:50
  • i edited the post and added the code i have used to plot both graphs.. is it possible to make the curves more normalized? – Shashank Apr 27 '14 at 17:51
  • What do you mean with "more normalized"? You can apply some smoothing operations like `plot "1" using 1:2 smooth csplines` or similar, see `help smooth`. – Christoph Apr 27 '14 at 17:53
  • Yes Smoothing is what i wanted..it looks much better now to distinguish between two.. thank you christoph :) – Shashank Apr 27 '14 at 17:57

1 Answers1

2

As a general remark first: Use the pngcairo terminal which provides much better antialiasing.

For processing of your data you can use different smoothing options, like smooth csplines, smooth bezier or similar (see e.g. help smooth in the interactive gnuplot terminal):

plot "1" using 1:2 smooth csplines, "2" using 1:2 smooth csplines

Which smoothing variant you use depend again on the meaning of your data.

What could also help, is to use other point types then the default ones, e.g. pt 1 for the first and pt 7 for the second one, see Gnuplot line types for the use of the test command to check the available point types.

Community
  • 1
  • 1
Christoph
  • 47,569
  • 8
  • 87
  • 187