[418] | 1 | (* This is a graph for Figure 2 of the USENIX jgraph abstract. It shows
|
---|
| 2 | how to extract points from a data file with awk, and how to use awk
|
---|
| 3 | to plot a function to match the data (the function that is plot here
|
---|
| 4 | is (n/k)log(n), where k is expermentally chosen to be 35000.
|
---|
| 5 |
|
---|
| 6 | There are two graphs plotted -- the first is the actual jgraph. The
|
---|
| 7 | second is a text string showing the input for the graph. Print it
|
---|
| 8 | out -- you'll see what I mean.
|
---|
| 9 |
|
---|
| 10 | *)
|
---|
| 11 |
|
---|
| 12 | newgraph
|
---|
| 13 | xaxis size 2.5
|
---|
| 14 | hash_labels font Helvetica
|
---|
| 15 | label : Number of indexed Records (N)
|
---|
| 16 | yaxis size 2.1
|
---|
| 17 | label : Running time (seconds)
|
---|
| 18 | hash_labels font Helvetica
|
---|
| 19 |
|
---|
| 20 | newcurve
|
---|
| 21 | marktype cross
|
---|
| 22 | label : Data
|
---|
| 23 | pts shell : awk '{print $5, $8}' data.txt
|
---|
| 24 |
|
---|
| 25 | newcurve
|
---|
| 26 | marktype none linetype solid
|
---|
| 27 | label : N log N / 35000
|
---|
[419] | 28 | pts shell : awk \
|
---|
[418] | 29 | ' $5 != 0 { \
|
---|
| 30 | print $5, $5 * log($5) / 35000}' \
|
---|
| 31 | data.txt
|
---|
| 32 |
|
---|
| 33 | copygraph
|
---|
| 34 | x_translate -3.1
|
---|
| 35 | border
|
---|
| 36 | xaxis nodraw min 0 max 1 size 2.3
|
---|
| 37 | yaxis nodraw min 0 max 1
|
---|
| 38 |
|
---|
| 39 | newstring hjl vjc x .03 y .5 font Courier fontsize 6 :
|
---|
| 40 | xaxis size 2.5 \
|
---|
| 41 | hash_labels font Helvetica\
|
---|
| 42 | label : Number of indexed Records (N)\
|
---|
| 43 | yaxis size 2.1 \
|
---|
| 44 | label : Running time (seconds)\
|
---|
| 45 | hash_labels font Helvetica\
|
---|
| 46 | \
|
---|
| 47 | newcurve \
|
---|
| 48 | marktype cross\
|
---|
| 49 | label : Data\
|
---|
| 50 | pts shell : awk '{print $5, $8}' data.txt\
|
---|
| 51 | \
|
---|
| 52 | newcurve\
|
---|
| 53 | marktype none linetype solid\
|
---|
| 54 | label : N log N / 35000\
|
---|
[419] | 55 | pts shell : awk \\
|
---|
[418] | 56 | ' $5 != 0 { \\
|
---|
| 57 | print $5, $5 * log($5) / 35000}' \\
|
---|
| 58 | data.txt\
|
---|