1
1
using GLMakie
2
- include (" HubbardTrees.jl" )
3
- include (" OrientTrees.jl" )
4
2
include (" EmbedTrees.jl" )
5
3
include (" ../spiders/Spiders.jl" )
6
4
include (" ../parameters/DynamicRays.jl" )
5
+ include (" ../parameters/RenderFractal.jl" )
7
6
8
- # ## Convenience functions
9
- function plottree! (scene,angle:: Rational )
10
- return plottree! (scene,OrientedHubbardTree (angle))
7
+ @recipe (TreePlot,EHT) do scene # TODO add kwargs to toggle plotting the julia set and the external rays
8
+ Theme ()
11
9
end
12
10
13
- function plottree! (scene,K:: Sequence )
14
- return plottree! (scene,HubbardTree (K))
15
- end
16
-
17
- function plottree (H)
18
- fig = Figure ()
19
- ax = Axis (fig[1 ,1 ])
20
- return (fig,plottree! (ax,H))
21
- end
22
- # ##
23
-
24
-
25
- function plottree! (scene, OHT:: OrientedHubbardTree ,steps = 8 ,colors = [])
26
- OZ = labelonezero (OHT)
11
+ function Makie. plot! (myplot:: TreePlot )
12
+ (EdgeList,Nodes) = adjlist (EHT. adj)
13
+ criticalorbit = orbit (EHT. zero)
27
14
28
- anglelist = allanglesof (OZ,OHT)
29
-
30
- (EdgeList,Nodes) = adjlist (OHT. adj)
31
-
32
- criticalorbit = orbit (OHT. zero)
33
-
34
15
labels = []
35
16
nodecolors = []
36
17
for node in Nodes
37
18
firstchar = node. items[1 ]
38
19
if firstchar == ' *'
39
20
push! (nodecolors," black" )
40
21
elseif firstchar == ' A' # we are fully in one of the 4 regions
41
- if OZ [node] == ' 0'
22
+ if EHT . onezero [node] == ' 0'
42
23
push! (nodecolors," blue" )
43
- elseif OZ [node] == ' *'
24
+ elseif EHT . onezero [node] == ' *'
44
25
push! (nodecolors," turquoise" )
45
- elseif OZ [node] == ' 1'
26
+ elseif EHT . onezero [node] == ' 1'
46
27
push! (nodecolors," green" )
47
28
end
48
29
elseif firstchar == ' B'
49
- if OZ [node] == ' 0'
30
+ if EHT . onezero [node] == ' 0'
50
31
push! (nodecolors," red" )
51
- elseif OZ [node] == ' *'
32
+ elseif EHT . onezero [node] == ' *'
52
33
push! (nodecolors," orangered2" )
53
- elseif OZ [node] == ' 1'
34
+ elseif EHT . onezero [node] == ' 1'
54
35
push! (nodecolors," orange" )
55
36
end
56
37
end
@@ -65,22 +46,16 @@ function plottree!(scene, OHT::OrientedHubbardTree,steps = 8,colors = [])
65
46
end
66
47
end
67
48
68
- zvaluedict = embednodes (OHT)
69
- zvalues = []
70
- for node in Nodes
71
- push! (zvalues,zvaluedict[node])
72
- end
49
+ zvalues = [EHT. vertices[node] for node in Nodes]
73
50
74
- E = refinedtree (OHT,zvaluedict,steps)
75
-
76
- pos = Point .(real .(zvalues)/ 2 ,imag .(zvalues)/ 2 ) # divide by 2 here for the scene coordinate system
51
+ pos = Point .(real .(zvalues),imag .(zvalues))
77
52
78
53
colorsforinterior = [" red" ," blue" ," green" ," orange" ]
79
54
80
55
for (ii,p) in enumerate (EdgeList)
81
56
for n in p
82
- cmplxedge = E [Set ([Nodes[ii],Nodes[n]])][2 ]
83
- realedge = Point .(real .(cmplxedge)/ 2 ,imag .(cmplxedge)/ 2 )
57
+ cmplxedge = EHT . edges [Set ([Nodes[ii],Nodes[n]])][2 ]
58
+ realedge = Point .(real .(cmplxedge),imag .(cmplxedge))
84
59
if nodecolors[ii] in colorsforinterior
85
60
col = nodecolors[ii]
86
61
elseif nodecolors[n] in colorsforinterior
@@ -90,17 +65,28 @@ function plottree!(scene, OHT::OrientedHubbardTree,steps = 8,colors = [])
90
65
elseif nodecolors[n] != = " black"
91
66
col = nodecolors[n]
92
67
end
93
- lines! (scene ,realedge,color = col,linewidth = 1 ,transparency = true ,overdraw = true )
68
+ lines! (myplot ,realedge,color = col,linewidth = 1 ,transparency = true ,overdraw = true )
94
69
end
95
70
end
96
71
97
- scatter! (scene,pos,color = nodecolors)
72
+ julia = inverseiterate (EHT. parameter,20 )
73
+ scatter! (myplot,real (julia),imag (julia),markersize = 1 ,color = " black" )
74
+
75
+
76
+ rays = collect (values (EHT. rays))
77
+ n = length (rays)
78
+ for (j ,ray) in enumerate (rays)
79
+ lines! (myplot,real (ray),imag (ray),color = get (ColorSchemes. rainbow, float (j)/ float (n)))
80
+ end
81
+
82
+ scatter! (myplot,pos,color = nodecolors)
98
83
tex = [node[2 ] for node in labels]
99
- text! (scene ,pos,text = tex)
100
-
101
- return scene
84
+ text! (myplot ,pos,text = tex)
85
+ limits! ( - 2 , 2 , - 2 , 2 )
86
+ return myplot
102
87
end
103
88
89
+
104
90
function plottree! (scene, H:: HubbardTree )
105
91
106
92
(E, nodes) = adjlist (H. adj)
0 commit comments