-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
abc1262
commit 91245dc
Showing
4 changed files
with
87 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PKG base pyml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
open Base | ||
|
||
let () = | ||
let plt = Matplotlib.init Default in | ||
let xys = | ||
List.init 120 ~f:(fun i -> | ||
let i = Float.of_int i in | ||
i, Float.sin (i /. 20.)) | ||
in | ||
let xys2 = | ||
List.init 120 ~f:(fun i -> | ||
let i = Float.of_int i in | ||
i, Float.cos (i /. 12.)) | ||
in | ||
Matplotlib.xlabel plt "x"; | ||
Matplotlib.ylabel plt "sin(x)"; | ||
Matplotlib.grid plt true; | ||
Matplotlib.plot plt ~color:Red ~xys; | ||
Matplotlib.plot plt ~color:Green ~linestyle:Dotted ~linewidth:2. ~xys:xys2; | ||
Matplotlib.savefig plt "test.png"; | ||
Matplotlib.show plt | ||
let xs = List.init 120 ~f:Float.of_int in | ||
let ys1 = List.map xs ~f:(fun i -> Float.sin (i /. 20.)) in | ||
let ys2 = List.map xs ~f:(fun i -> Float.cos (i /. 12.)) in | ||
let xs = Matplotlib.V.l xs in | ||
let ys1 = Matplotlib.V.l ys1 in | ||
let ys2 = Matplotlib.V.l ys2 in | ||
Matplotlib.xlabel "x"; | ||
Matplotlib.ylabel "sin(x)"; | ||
Matplotlib.grid true; | ||
Matplotlib.plot ~color:Red ~xs ys1; | ||
Matplotlib.plot ~color:Green ~linestyle:Dotted ~linewidth:2. ~xs ys2; | ||
Matplotlib.savefig "test.png"; | ||
Matplotlib.show () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters