1
votes

Am trying to create a histogram showing Internet Packet sizes for UDP and TCP traffic. I am using the following gnuplot code

set terminal eps
set output 'packet_size_2012.eps'
set boxwidth 0.75 absolute
set style fill   solid 1.00 border lt -1
set key inside noenhanced nobox
set key invert samplen 4 spacing 1 width 0 height 0 
set style histogram rowstacked title  offset character 0, 0, 0
set style data histograms
set ylabel "Percentage of Packets (%) "
set xlabel "Frame Size (bytes)"
set xtics border in scale 0,0 nomirror rotate by -45  autojustify
set yrange [ 0 : 50 ] noreverse nowriteback
plot 'packet_size_percent_2012.dat' using 2:xtic(1), for [i=3:3] '' using i

and I am using the following dataset file called packet_size_percent_2012.dat.

Size TCP UDP  
>100    37.9751914726   3.8006927347
>200    2.40410662  1.2339364475
>300    1.214213436 0.2644495664
>400    2.8001210777    0.1767652772
>500    0.8650757197    0.0724963219
>600    0.8767813751    0.1582132766
>700    0.4833217953    0.067857265
>800    0.4663420621    0.0625691477
>900    0.4081899064    0.0389895145
>1000   0.4181337618    0.0364423356
>1100   0.5492004791    0.4992289447
>1200   0.3614408031    0.4492694873
>1300   11.1826219794   0.0841426493
>1400   2.2600786977    0.4211750387
>1518   29.0098254538   1.3591273532

The plot is generated and looks nice but the key is all wrong. Can anyone explain how I can fix the key?

1

1 Answers

0
votes

With set key auto columnheader the actual column headers are used as key entries (I guess that is what you intend):

enter image description here