/usr/share/doc/libplplot12/examples/ocaml/x12.ml is in libplplot-dev 5.10.0+dfsg2-0.1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 50 51 52 53 54 55 56 57 | (* $Id: x12.ml 10463 2009-09-23 20:56:58Z hezekiahcarty $
Bar chart demo.
*)
open Plplot
let plfbox x0 y0 =
let x = [|x0; x0; x0 +. 1.0; x0 +. 1.0|] in
let y = [|0.0; y0; y0; 0.0|] in
plfill x y;
plcol0 1;
pllsty 1;
plline x y;
()
(*--------------------------------------------------------------------------*\
* Does a simple bar chart, using color fill. If color fill is
* unavailable, pattern fill is used instead (automatic).
\*--------------------------------------------------------------------------*)
let pos = [|0.0; 0.25; 0.5; 0.75; 1.0|]
let red = [|0.0; 0.25; 0.5; 1.00; 1.0|]
let green = [|1.0; 0.50; 0.5; 0.50; 1.0|]
let blue = [|1.0; 1.0; 0.5; 0.25; 0.0|]
let () =
(* Parse and process command line arguments *)
plparseopts Sys.argv [PL_PARSE_FULL];
(* Initialize plplot *)
plinit ();
pladv 0;
plvsta ();
plwind 1980.0 1990.0 0.0 35.0;
plbox "bc" 1.0 0 "bcnv" 10.0 0;
plcol0 2;
pllab "Year" "Widget Sales (millions)" "#frPLplot Example 12";
let y0 = [|5.0; 15.0; 12.0; 24.0; 28.0; 30.0; 20.0; 8.0; 12.0; 3.0|] in
plscmap1l true pos red green blue None;
for i = 0 to 9 do
(* plcol0 (i + 1); *)
plcol1(float_of_int i /. 9.0);
plpsty 0;
plfbox (1980.0 +. float_of_int i) y0.(i);
let text = Printf.sprintf "%.0f" y0.(i) in
plptex (1980.0 +. float_of_int i +. 0.5) (y0.(i) +. 1.0) 1.0 0.0 0.5 text;
let text = string_of_int (1980 + i) in
plmtex "b" 1.0 (float_of_int (i + 1) *. 0.1 -. 0.05) 0.5 text;
done;
(* Don't forget to call plend() to finish off! *)
plend ();
()
|