File: ticlabels.sl

package info (click to toggle)
slxfig 0.2.0~.138-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,196 kB
  • sloc: sh: 3,086; ansic: 598; makefile: 265; php: 6
file content (45 lines) | stat: -rw-r--r-- 1,643 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require ("xfig");

public define slsh_main ()
{
   variable i;
   _for i (1, 4, 1)
     {
       variable w = xfig_plot_new();
       variable x = [0:10:0.1];
       w.plot(x, x^2);

       switch(i)
       { case 1:
           message("The following statement will produce the warning"
                  +` "4 major ticmarks / 3 ticlabels":`);
           w.x1axis(; major=[              1,      2,      5,       10    ],
                  ticlabels=[              "one?", "two?", "five?"        ],
                      minor=[0:10]);
       }
       { case 2:
           message("The following statement will produce the warning"
                  +` "3 major ticmarks / 4 ticlabels":`);
           w.x1axis(; major=[              1,      2,      5              ],
                  ticlabels=[              "one?", "two?", "five?", "ten?"],
                      minor=[0:10]);
       }
       { case 3:
           % The major and ticlabels qualifiers
           % should be used in the following way:
           w.x1axis(; major=[              1,      2,      5,       10    ],
                  ticlabels=[              "one!", "two!", "five!", "ten!"],
                      minor=[0:10]);
       }
       { case 4:
           % The following statement will work correctly:
           % both user_specified_major_tic -1
           %  and user_specified_tic_label "minus one!" will be ignored.
           w.x1axis(; major=[-1,           1,      2,      5,       10    ],
                  ticlabels=["minus one!", "one!", "two!", "five!", "ten!"],
                      minor=[0:10]);
       }

       w.render("ticlabels.png");
     }
}