0

I have the following GNUplot file:

set title "Performance of Quicksort over random data sets"
set yrange [0:80000]
set style data histogram
set style histogram cluster
set style fill solid border -1
set boxwidth 0.9
plot for [COL=2:6:1] 'timings.dat' using COL

and the following data file:

# Data-size being x-axis, each data size having a histogram-bar for seq/2-t/4-t/8-t/16-t (color-coded)
# Y-axis is time (the information in the columns below Sequential for example being the timings of sequential program for 2^15...2^28)

Data-size Sequential 2-threaded 4-threaded 8-threaded 16-threaded
2^15      6          4       5     7          10   
2^16      11         9       9     11         19   
2^17      24        17       18        24         32   
2^18      49        35       32        43         59   
2^19      102       71       70        89         115  
2^20      208       145      135       161        201  
2^21      431       295      281       333        416  
2^22      895       598      550       667        870  
2^23      1887      1219     1173      1228       1639 
2^24      3852      2979     2478      2621       3457 
2^25      7962      4980     4693      5064       6834 
2^26      16329     10151    9332      10062      13217
2^27      33775     21039    19072     20008      25196
2^28      69995     43393    38091     40598      52492

And this is what the resulting gnuplot image looks like:

gnuplot

My two issues are:

  1. The x-axis should be labeled according to the data-size column (2^15,...,2^28)

  2. The bars should be named according to their name in the data table (Sequential, 2-threaded, and so on)

I've read through parts of the manual, which got me to this stage, but I'm not experienced enough to understand how what I want can be done unfortunately.

1

I think what you want is

plot for [COL=2:6:1] 'timings.dat' using COL:xticlabels(1) title columnheader

however you may need to modify the first column powers to 2^{15} and so on in order that they are properly parsed:

$ cat timings.dat 
# Data-size being x-axis, each data size having a histogram-bar for seq/2-t/4-t/8-t/16-t (color-coded)
# Y-axis is time (the information in the columns below Sequential for example being the timings of sequential program for 2^{15}...2^28)

Data-size Sequential 2-threaded 4-threaded 8-threaded 16-threaded
2^{15}      6          4       5     7          10   
2^{16}      11         9       9     11         19   
2^{17}      24        17       18        24         32   
2^{18}      49        35       32        43         59   
2^{19}      102       71       70        89         115  
2^{20}      208       145      135       161        201  
2^{21}      431       295      281       333        416  
2^{22}      895       598      550       667        870  
2^{23}      1887      1219     1173      1228       1639 
2^{24}      3852      2979     2478      2621       3457 
2^{25}      7962      4980     4693      5064       6834 
2^{26}      16329     10151    9332      10062      13217
2^{27}      33775     21039    19072     20008      25196
2^{28}      69995     43393    38091     40598      52492

enter image description here

  • Thank you that's exactly what I needed! I'm sorry for the late accept, I had to merge my new account with the old one. How did you get good at using gnuplot? Did you read a book? – Johan Sjolen Feb 5 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.