Skip to content

Commit eed9ed1

Browse files
committed
Saved buggy_lines as seperate file
1 parent 59ad0ee commit eed9ed1

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed

angular_lines.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,21 @@
2525
"bg_rgb": [(0.05, 0.05, 0.05), (0.15, 0.15, 0.15)]
2626
}
2727

28-
n_lines = 3000
28+
n_lines = 1000
2929
cm = cm.viridis
3030

3131
# Draw to canvas
3232
with Canvas(**cnv_conf) as cnv:
3333

3434
angle = 0.5*pi*np.random.uniform()
35+
angle = 0.25*pi
3536
y0 = np.random.uniform(0.1*1, 1, n_lines)
36-
x0 = y0*np.tan(y0)
37+
x0 = y0*np.tan(angle)
3738
col_mid = choice(y0)
38-
col_vec = 1.1 - y0 + np.random.normal(0, 0.5, n_lines)
39-
col_vec = (col_vec - min(col_vec))/(max(col_vec) - min(col_vec))
39+
col_vec = (y0 - min(y0))/max(y0 - min(y0))
4040
colors = cm(col_vec, alpha=0.15)
4141

4242
for x, y, col in zip(x0, y0, colors):
4343
edge = [[0, y], [x, 0]]
4444
cnv.draw_edge(edge, 0.00001, col)
45+

buggy_angular_lines.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env python
2+
3+
import cairo as cr
4+
import numpy as np
5+
from random import choice
6+
from math import pi
7+
8+
from src.objects import DrawGraph
9+
from src.draw import Canvas
10+
from fn import Fn
11+
from matplotlib import cm
12+
13+
# Constants
14+
15+
16+
# Create graph
17+
18+
19+
# Document configuration
20+
cnv_conf = {
21+
"fname": f"temp/{Fn().name()}",
22+
"dpi": 300,
23+
"width": 10,
24+
"height": 20,
25+
"bg_rgb": [(0.05, 0.05, 0.05), (0.15, 0.15, 0.15)]
26+
}
27+
28+
n_lines = 3000
29+
cm = cm.viridis
30+
31+
# Draw to canvas
32+
with Canvas(**cnv_conf) as cnv:
33+
34+
angle = 0.5*pi*np.random.uniform()
35+
y0 = np.random.uniform(0.1*1, 1, n_lines)
36+
x0 = y0*np.tan(y0)
37+
col_mid = choice(y0)
38+
col_vec = 1.1 - y0 + np.random.normal(0, 0.5, n_lines)
39+
col_vec = (col_vec - min(col_vec))/(max(col_vec) - min(col_vec))
40+
colors = cm(col_vec, alpha=0.15)
41+
42+
for x, y, col in zip(x0, y0, colors):
43+
edge = [[0, y], [x, 0]]
44+
cnv.draw_edge(edge, 0.00001, col)

0 commit comments

Comments
 (0)