-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented Makie plot, extended
N
for #10
- Loading branch information
1 parent
e2fdfd0
commit e3329c6
Showing
12 changed files
with
242 additions
and
150 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
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 was deleted.
Oops, something went wrong.
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,25 @@ | ||
name = "Fatou" | ||
uuid = "5f923234-c850-556d-bb4f-28324fa1959a" | ||
authors = ["Michael Reed"] | ||
version = "1.1.1" | ||
|
||
[deps] | ||
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4" | ||
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" | ||
SyntaxTree = "a4af3ec5-f8ac-5fed-a759-c2e80b4d74cb" | ||
Reduce = "93e0c654-6965-5f22-aba9-9c1ae6b3c259" | ||
Requires = "ae029012-a4dd-5104-9daa-d747884805df" | ||
|
||
[compat] | ||
julia = "1" | ||
Reduce = "1.2" | ||
Requires = "1" | ||
SyntaxTree = "1" | ||
ColorSchemes = "3" | ||
LaTeXStrings = "1" | ||
|
||
[extras] | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["Test"] |
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
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,79 @@ | ||
# This file is part of Fatou.jl. It is licensed under the MIT license | ||
# Copyright (C) 2019 Michael Reed | ||
|
||
import ColorSchemes | ||
|
||
Makie.plot(K::FilledSet;bare=false,args...) = Makie.heatmap(K;bare=bare,args...) | ||
|
||
for plt ∈ (:contour,:contourf,:heatmap) | ||
plt! = Symbol(plt,:!) | ||
@eval function Makie.$plt(K::FilledSet;bare::Bool=false,args...) | ||
scene, layout = Makie.layoutscene() | ||
ax = layout[1,1] = if K.meta.newt | ||
Makie.Axis(scene,title=String(K),ylabel="Fatou set: z ↦ z-m×f(z)/f'(z)") | ||
else | ||
Makie.Axis(scene,title=String(K)) | ||
end | ||
plt = Makie.$plt!(ax,K;args...) | ||
layout[1,2] = Makie.Colorbar(scene,plt;width=30) | ||
return scene | ||
end | ||
@eval function Makie.$plt!(ax,K::FilledSet;bare::Bool=false,args...) | ||
!haskey(args,:colormap) && !isempty(K.meta.cmap) && (return Makie.$plt!(ax,K;bare=bare,colormap=Symbol(K.meta.cmap),args...)) | ||
r1,r2 = ranges(K) | ||
Z = $(plt≠:heatmap ? :(transpose(K.meta.iter ? K.iter : K.mix)) : :(reverse(transpose(K.meta.iter ? K.iter : K.mix),dims=2))) | ||
if bare | ||
Makie.$plt!(ax,r1,r2,Z;args...) | ||
else | ||
Makie.$plt!(ax,r1,r2,Z;axis=(title=String(K),),args...) | ||
end | ||
end | ||
end # center!(scene) | ||
|
||
function Makie.surface(K::FilledSet;bare::Bool=false,args...) | ||
!haskey(args,:colormap) && !isempty(K.meta.cmap) && (return Makie.surface(K;bare=bare,colormap=Symbol(K.meta.cmap),args...)) | ||
r1,r2 = ranges(K) | ||
Z = reverse(reverse(transpose(K.meta.iter ? K.iter : K.mix),dims=1),dims=2) | ||
if bare | ||
Makie.surface(reverse(r1),r2,Z;(xreversed=true,)args...) | ||
else | ||
Makie.surface(reverse(r1),r2,Z;axis=(title=String(K),xreversed=true),args...) | ||
end | ||
end | ||
|
||
function Makie.arrows(K::FilledSet;bare::Bool=false,args...) | ||
r1,r2 = ranges(K) | ||
Z = transpose(K.set) | ||
Makie.arrows(r1,r2,real.(Z),imag.(Z);args...) | ||
end | ||
|
||
function orbit(E,f::Function,bi::Matrix{Float64},orb::Int=0,depth::Int=1,incr::Int=384) | ||
x,N,N2,orbit,bis = real_orb(E,f,bi,orb,depth,incr) | ||
# setup plot | ||
funs,funt = ~(orb == 0) ? (["ϕ(x₀₋ₙ)"],", IC: x₀ = $(bis[3]), n∈0:$orb") : ([],"") | ||
scene, layout = Makie.layoutscene() | ||
ax = layout[1,1] = Makie.Axis(scene,title="x ↦ $E$funt") | ||
# plot background lines | ||
plt = [Makie.lines!(ax,x[:],N[:,1];linestyle=:dash), | ||
Makie.lines!(ax,x[:],N[:,2]), | ||
# plot orbit cobweb path | ||
Makie.lines!(ax,orbit[:,1],orbit[:,2];color=:red)] | ||
# plot f^2,f^3,f^4,... | ||
for h ∈ 3:depth+1 | ||
push!(plt,Makie.lines!(ax,x,N[:,h];linewidth=1,color=ColorSchemes.tab10[h>5 ? h-1 : h-2])) | ||
end | ||
if orb≠0 | ||
ran = range(bi[1],stop=bi[2],length=length(N2)) | ||
plt = [plt...,[ | ||
Makie.lines!(ax,ran,N2[:];color=:gray,linestyle=:dot,linewidth=1), | ||
Makie.scatter!(ax,ran,N2[:];color=:gray,marker=:x)]] | ||
end | ||
# trim graph | ||
d=1.07 | ||
Makie.xlims!(ax,bi[1],bi[2]) | ||
Makie.ylims!(ax,minimum([d*minimum(N[:,2]),0]),maximum([d*maximum(N[:,2]),0])) | ||
# set legend | ||
layout[1,2] = Legend(scene,plt,vcat(["y=x","ϕ(x)","(xₙ,ϕ(xₙ))"],["ϕ^$x(x)" for x ∈ 2:depth],funs)) | ||
return scene | ||
end | ||
|
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
Oops, something went wrong.