-
Notifications
You must be signed in to change notification settings - Fork 10
/
plotting.ml
49 lines (46 loc) · 1.23 KB
/
plotting.ml
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
46
47
48
49
module B = PrintBox
module BPlot = PrintBox_ext_plot
(* This tests the printbox-ext-plot extension. *)
let test ~size =
BPlot.(
box
{
default_config with
size;
specs =
[
Scatterbag
{
points =
[|
(0., 1.), B.line "Y";
(1., 0.), B.line "X";
(0.75, 0.75), B.line "M";
|];
};
Map
{
callback =
(fun (x, y) ->
let s = ((x ** 2.) +. (y ** 2.)) ** 0.5 in
B.line
@@
if s < 0.3 then
" "
else if s < 0.6 then
"."
else if s < 0.9 then
","
else if s < 1.2 then
":"
else
";");
};
];
})
let () =
print_endline "Text output:";
print_endline @@ PrintBox_text.to_string
@@ test ~size:BPlot.default_config.size;
print_endline "\nHTML output:";
print_endline @@ PrintBox_html.to_string @@ test ~size:(800, 800)