Rename *ll* and *ul* to ll and ul in defint
[maxima.git] / share / descriptive / rtest_statgraph.mac
blob2e70c3ba54355863c3abcca05af2dbe10cd9c18b
1 /* execute this script
2  *
3  * (1) wait for user between examples:
4  *  demo ("rtest_statgraph.mac")
5  *
6  * (2) or noninteractively:
7  *  batch ("rtest_statgraph.mac");
8  *
9  * Maxima waits for the user to close the Openmath window
10  * before proceeding, but otherwise it just blazes through.
11  */
13 load("descriptive");
14 load("distrib");
16 barsplot(
17                   col(m,2),
18                   title        = "Ages",
19                   xlabel       = "years",
20                   box_width    = 1/2,
21                   fill_density = 3/4), m : read_matrix (file_search ("biomed.data"));
24 barsplot(
25                   l1,l2,
26                   box_width    = 1,
27                   fill_density = 1,
28                   bars_colors  = [black, grey],
29                   frequency = relative,
30                   sample_keys = ["A", "B"]),
31                 l1:makelist(random(10),k,1,50),
32                 l2:makelist(random(10),k,1,100);
35 barsplot(
36                   makelist([Yes, No, Maybe][random(3)+1],k,1,50),
37                   makelist([Yes, No, Maybe][random(3)+1],k,1,50),
38                   makelist([Yes, No, Maybe][random(3)+1],k,1,50),
39                   makelist([Yes, No, Maybe][random(3)+1],k,1,50),
40                   title  = "Asking for something to four groups",
41                   ylabel = "# of individuals",
42                   groups_gap   = 3,
43                   fill_density = 0.5,
44                   ordering     = ordergreatp);
46 barsplot(
47                   makelist([Yes, No, Maybe][random(3)+1],k,1,50),
48                   makelist([Yes, No, Maybe][random(3)+1],k,1,50),
49                   makelist([Yes, No, Maybe][random(3)+1],k,1,50),
50                   makelist([Yes, No, Maybe][random(3)+1],k,1,50),
51                   title  = "Asking for something to four groups",
52                   ylabel = "# of individuals",
53                   grouping     = stacked,
54                   fill_density = 0.5,
55                   ordering     = ordergreatp);
57 block([l1:makelist(random(10),k,1,50),
58   l2:makelist(random(10),k,1,100),
59   bp1, bp2],
60   bp1 :
61                   barsplot_description(
62                    l1,
63                    box_width = 1,
64                    fill_density = 0.5,
65                    bars_colors = [blue],
66                    frequency = relative),
67   bp2 :
68                   barsplot_description(
69                    l2,
70                    box_width = 1,
71                    fill_density = 0.5,
72                    bars_colors = [red],
73                    frequency = relative),
74   draw(gr2d(bp1), gr2d(bp2)));
77 boxplot(s2,
78                   box_width  = 0.2,
79                   title      = "Windspeed in knots",
80                   xlabel     = "Stations",
81                   color      = red,
82                   line_width = 2), s2 : read_matrix(file_search("wind.data"));
84 boxplot (A, box_orientation = horizontal), A :
85                  [[6, 4, 6, 2, 4, 8, 6, 4, 6, 4, 3, 2],
86                   [8, 10, 7, 9, 12, 8, 10],
87                   [16, 13, 17, 12, 11, 18, 13, 18, 14, 12]];
90 histogram (
91                      s1,
92                      nclasses     = 8,
93                      title        = "pi digits",
94                      xlabel       = "digits",
95                      ylabel       = "Absolute frequency",
96                      fill_color   = grey,
97                      fill_density = 0.6), s1 : read_list (file_search ("pidigits.data"));
99 block([m: 14, s: 2, s2],
100   s2: random_normal(m, s, 1000),
101   draw2d(
102     grid   = true,
103     xrange = [5, 25],
104     histogram_description(
105       s2,
106       nclasses     = 9,
107       frequency    = density,
108       fill_density = 0.5),
109     explicit(pdf_normal(x,m,s), x, m - 3*s, m + 3* s)));
111 piechart(
112                   s1,
113                   xrange  = [-1.1, 1.3],
114                   yrange  = [-1.1, 1.1],
115                   title   = "Digit frequencies in pi"), s1 : read_list (file_search ("pidigits.data"));
117 scatterplot(
118                   random_normal(0,1,200),
119                   xaxis      = true,
120                   point_size = 2,
121                   dimensions = [600,150])$
123 block([l1: makelist(random(10),k,1,50),
124   l2: makelist(random(10),k,1,200)],
125           starplot(
126                   l1, l2,
127                   stars_colors = [blue,red],
128                   sample_keys = ["1st sample", "2nd sample"],
129                   star_center = [1,2],
130                   star_radius = 4,
131                   proportional_axes = xy,
132                   line_width = 2 ));
134 stemplot(
135                   random_normal(15, 6, 100),
136                   leaf_unit = 0.1);