/usr/share/doc/libplplot12/examples/ocaml/x34.ml is in libplplot-dev 5.10.0+dfsg-1.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | (* $Id$
Drawing mode setting and getting example.
Copyright (C) 2011 Hezekiah M. Carty
This file is part of PLplot.
PLplot is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
PLplot is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with PLplot; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
open Plplot
(* Drawing modes to demonstrate *)
let drawing_modes = [|
PL_DRAWMODE_DEFAULT;
PL_DRAWMODE_REPLACE;
PL_DRAWMODE_XOR;
|]
let drawing_mode_names = [|
"Default drawing mode";
"Replace destination with source";
"XOR drawing";
|]
let initialize_colors () =
plscol0 0 255 255 255;
plscol0 1 0 0 0;
plscol0 2 255 0 0;
plscol0a 3 0 0 255 0.3;
()
let draw_page mode title =
(* A triangle for the background *)
let xs = [|0.0; 1.0; 0.0|] in
let ys = [|0.0; 1.0; 1.0|] in
(* A circle for the foreground *)
let over_x = 0.5 in
let over_y = 0.5 in
let over_r = 0.4 in
plcol0 1;
(* Setup a plot window *)
plenv 0.0 1.0 0.0 1.0 1 0;
(* Show which mode we're using *)
pllab "" "" title;
(* Draw a background triangle using the default drawing mode *)
plcol0 2;
plsdrawmode PL_DRAWMODE_DEFAULT;
plfill xs ys;
(* Draw a circle in the given drawing mode *)
plcol0 3;
plsdrawmode mode;
plarc over_x over_y over_r over_r 0.0 360.0 0.0 true;
()
(*--------------------------------------------------------------------------
main
--------------------------------------------------------------------------*)
let main =
(* PLplot initialization *)
(* Parse and process command line arguments *)
plparseopts Sys.argv [PL_PARSE_FULL];
(* Initialize PLplot *)
plinit ();
(* Check for drawing mode support *)
let mode = plgdrawmode () in
if mode = PL_DRAWMODE_UNKNOWN then begin
print_endline "WARNING: This driver does not support drawing mode getting/setting";
end
else begin
(* Setup colors *)
initialize_colors ();
(* Draw one page per drawing mode *)
Array.iteri (fun i mode -> draw_page mode drawing_mode_names.(i))
drawing_modes;
end;
(* Clean up *)
plend ();
()
|