-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsine.exs
More file actions
34 lines (28 loc) · 668 Bytes
/
sine.exs
File metadata and controls
34 lines (28 loc) · 668 Bytes
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
defmodule Sine do
import Gnuplot
@moduledoc "http://gnuplot.sourceforge.net/demo/simple.7.gnu"
def png, do: Path.join("docs", "sine.PNG")
def target,
do: [
[:set, :term, :pngcairo, :size, '512,256', :font, "Fira Sans"],
[:set, :output, png()]
]
def commands,
do: [
~w(set style line 1 linecolor rgb '#77216F' linetype 1 linewidth 2)a,
~w(unset xzeroaxis)a,
~w(unset yzeroaxis)a,
~w(set ytics -1,1)a,
[
:plot,
'sin(x)',
:title,
"Sine Wave",
:ls,
1
]
]
def plot, do: plot(target() ++ commands())
end
# mix run examples/sine.exs
Sine.plot()