Line | |
---|
1 | (* This is an extension of sin.jgr only this time, the axes are at
|
---|
2 | x = 0 and y = 0. The hash labels are printed at the left and bottom. *)
|
---|
3 |
|
---|
4 | newgraph
|
---|
5 |
|
---|
6 | yaxis min -1 max 1 label : sin(i)
|
---|
7 | no_draw_hash_marks no_draw_axis_line
|
---|
8 |
|
---|
9 | xaxis min -10 max 10 label : i
|
---|
10 | no_draw_hash_marks no_draw_axis_line
|
---|
11 |
|
---|
12 | (* Plot the sin curve *)
|
---|
13 | curve 1
|
---|
14 | marktype none
|
---|
15 | linetype solid
|
---|
16 | pts include sin.pts
|
---|
17 | (* sin.pts was created by the following c program:
|
---|
18 |
|
---|
19 | #include <math.h>
|
---|
20 | main();
|
---|
21 | {
|
---|
22 | double x;
|
---|
23 | for (x = -10.0; x < 10.0; x += .03)
|
---|
24 | printf("%f %f\n", x, sin(x));
|
---|
25 | }
|
---|
26 |
|
---|
27 | *)
|
---|
28 |
|
---|
29 | (* Now, create a new graph with the same dimensions, but with the
|
---|
30 | * x & y axes in a different place, and with no axis or hash labels.
|
---|
31 | * Also, make the hash marks smaller. *)
|
---|
32 |
|
---|
33 | newgraph
|
---|
34 | inherit_axes
|
---|
35 | xaxis draw draw_at 0 hash_scale -.5 no_draw_hash_labels no_draw_axis_label
|
---|
36 | yaxis draw draw_at 0 hash_scale -.5 no_draw_hash_labels no_draw_axis_label
|
---|
37 |
|
---|
38 | (* Finally, we want the hash marks to be centered around the axes,
|
---|
39 | * so draw them again with a scaling of +5.
|
---|
40 | *)
|
---|
41 |
|
---|
42 | newgraph
|
---|
43 | inherit_axes
|
---|
44 | xaxis hash_scale .5
|
---|
45 | yaxis hash_scale .5
|
---|
46 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.