Skip to content

Commit 87f54e8

Browse files
committed
Smooth scatter plot with pngcairo
1 parent f55214d commit 87f54e8

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Write two datasets to a PNG file:
5555

5656
```elixir
5757
{:ok, _cmd} = G.plot([
58-
[:set, :term, :png],
58+
[:set, :term, :png],
5959
[:set, :output, "/tmp/rand.png"]
6060
[:set, :title, "rand uniform vs normal"],
6161
[:set, :key, :left, :top],
@@ -65,8 +65,8 @@ Write two datasets to a PNG file:
6565
["-", :title, "normal", :with, :points])]
6666
],
6767
[
68-
for(n <- 0..200, do: [n, n * :rand.uniform()]),
69-
for(n <- 0..200, do: [n, n * :rand.normal()])
68+
for(n <- 0..100, do: [n, n * :rand.uniform()]),
69+
for(n <- 0..100, do: [n, n * :rand.normal()])
7070
])
7171
```
7272

docs/rand.PNG

12.2 KB
Loading

examples/atan_sin.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ defmodule AtanSin do
2020
:plot,
2121
-30..20,
2222
'sin(x*20)*atan(x)',
23-
:ls, 1
23+
:ls,
24+
1
2425
]
2526
]
2627

examples/rand.exs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,28 @@ defmodule Rand do
77

88
def target,
99
do: [
10-
[:set, :term, :png, :size, '512,256', :font, "/Library/Fonts/FiraCode-Medium.ttf", 12],
10+
[:set, :term, :pngcairo, :size, '512,256', :font, "Fira Sans,12"],
1111
[:set, :output, png()]
1212
]
1313

1414
def commands,
1515
do: [
1616
~w(set key left top)a,
17+
~w(set style line 1 lc rgb '#77216F' pt 13)a,
18+
~w(set style line 2 lc rgb '#599B2B' pt 2)a,
1719
[
1820
:plot,
1921
G.list(
20-
["-", :title, "uniform", :with, :points],
21-
["-", :title, "normal", :with, :points]
22+
["-", :title, "uniform", :with, :points, :ls, 1],
23+
["-", :title, "normal", :with, :points, :ls, 2]
2224
)
2325
]
2426
]
2527

2628
def data,
2729
do: [
28-
for(n <- 0..196, do: [n, n * :rand.uniform()]),
29-
for(n <- 0..196, do: [n, n * :rand.normal()])
30+
for(n <- 0..99, do: [n, n * :rand.uniform()]),
31+
for(n <- 0..99, do: [n, n * :rand.normal()])
3032
]
3133

3234
def plot, do: G.plot(target() ++ commands(), data())

examples/sine.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ defmodule Sine do
77

88
def target,
99
do: [
10-
[:set, :term, :pngcairo, :size, '512,256' ,:font, "Fira Sans"],
10+
[:set, :term, :pngcairo, :size, '512,256', :font, "Fira Sans"],
1111
[:set, :output, png()]
1212
]
1313

0 commit comments

Comments
 (0)