source: trunk/Jgraph/g9n10.jgr@ 660

Last change on this file since 660 was 418, checked in by Nicholas Riley, 17 years ago

Jgraph 8.3 from http://www.cs.utk.edu/~plank/plank/jgraph/jgraph.tar.gz

File size: 3.8 KB
Line 
1(* This file plots two graphs side by side with a tricky legend format:
2 * There are 5 legend entries, one of which is of a curve containing a
3 * line. The desire is to make the legend have two columns, the first
4 * with the first three legend entries, and the second with the last
5 * two.
6 *
7 * The way that this is done is to actually plot four graphs -- two sets
8 * of two graphs superimposed on each other. The first of the two
9 * graphs has the first three curves, and the second has the last two.
10 * Thus, the first can set its legend to be the first column, and the
11 * second can set its legend to be the second column.
12 *
13 * To get the two columns is pretty simple. In each graph, the
14 * x and y coordinates of the legends are explicitly set. For the
15 * first column, the x coordinate is 0, and for the second column,
16 * the x coordinate is 5.5.
17 *
18 * A potential problem with this graph is that in the first set of
19 * legends, there is a line (the "Merge Sort" curve), while in the
20 * second set there is not. Thus, if nothing is done with the midspace
21 * and linelength paramters, the second columns marks will appear closer
22 * to the text than in the first column. The solution to this was to
23 * explicitly set the linelength and midspace in the first legend to
24 * be .80 and .25 respectively. This means that in the first legend, the
25 * marks are 0.65 units away from the text (in the presence of a line,
26 * the marks are (midspace + linelength/2) away from the text. In
27 * the absence of a line, the marks are simply (midspace) away from the
28 * text. Thus, midspace is set to be 0.65 in the second legend column.
29 *)
30
31(* Set up the axes of the first graph. Translate it to the left of the
32 * page *)
33
34newgraph
35x_translate -1.37
36yaxis size 1.9 min 0 max 40 precision 0 hash 10 mhash 1
37 label : Time (sec)
38 fontsize 8
39xaxis size 2.14 min 0 max 10 hash 2 mhash 1
40 label : Heap Size (MBytes)
41 fontsize 8
42title : Graph 9: Checkpoint Time of Other Benchmarks.
43 fontsize 10
44
45(* Draw the first three curves *)
46newcurve
47 label : Merge Sort
48 marktype circle fill 0.0
49 linetype solid
50 pts
51 .789 5.5414
52 2.985 13.9958
53 3.962 17.2362
54 4.938 21.0804
55 7.868 32.4082
56 9.821 39.8312
57newcurve
58 label : Travelling Salesman
59 marktype triangle fill 0
60 linetype none
61 pts
62.064 2.359
63newcurve
64 label : Pattern Match
65 marktype diamond fill 1.0
66 linetype none
67 pts
681.233 6.374
69
70(* set the legend *)
71legend linelength .8 midspace .25 x 0 y 47.5 defaults fontsize 7
72
73(* Now make a second graph for the second curve with the same axes *)
74copygraph
75xaxis nodraw
76yaxis nodraw
77
78(* Draw the last two curves *)
79newcurve
80 label : Bubble Sort
81 marktype cross fill 1.0
82 linetype none
83 pts
84.513 3.91
85newcurve
86 label : Matrix Multiplication
87 marktype box fill 1
88 linetype none
89 pts
903 14.71
91
92(* set the second legend to be a second column from the first *)
93legend x 5.5 midspace .65
94
95(* The second of these graphs is just like the first only it is translated
96to the right *)
97
98copygraph
99x_translate 1.7
100xaxis draw
101yaxis draw
102yaxis min 0 max 5 hash 1 mhash 1
103title : Graph 10: Checkpoint Overhead of Other Benchmarks.
104 fontsize 10
105
106newcurve
107 label : Merge Sort
108 marktype circle fill 0.0
109 linetype solid
110 pts
111 .789 0.5954
112 2.985 3.8368
113 3.962 3.3598
114 4.938 3.6288
115 7.868 4.3096
116 9.821 4.377
117
118newcurve
119 label : Travelling Salesman
120 marktype triangle fill 0
121 linetype none
122 pts
123.064 0.17
124
125newcurve
126 label : Pattern Match
127 marktype diamond fill 1.0
128 linetype none
129 pts
1301.233 0.07
131
132legend linelength .8 midspace .25 x 0 y 5.9 defaults fontsize 7
133
134copygraph
135xaxis nodraw
136yaxis nodraw
137
138newcurve
139 label : Bubble Sort
140 marktype cross fill 1.0
141 linetype none
142 pts
143.513 0.07
144
145newcurve
146 label : Matrix Multiplication
147 marktype box fill 1
148 linetype none
149 pts
1503 0.75
151
152legend x 5.5 midspace .65
Note: See TracBrowser for help on using the repository browser.