Skip to content

Commit

Permalink
fixed GLMakie compatibility bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Jun 9, 2021
1 parent eb7adec commit eac2512
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Fatou"
uuid = "5f923234-c850-556d-bb4f-28324fa1959a"
authors = ["Michael Reed"]
version = "1.1.2"
version = "1.1.3"

[deps]
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
Expand Down
2 changes: 1 addition & 1 deletion src/Fatou.jl
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ function __init__()
!bare && print(io,String(K))
end
end
@require Makie="ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" include("makie.jl")
@require AbstractPlotting="537997a7-5e4e-5d89-9595-2241ea00577e" include("makie.jl")
@require PyPlot="d330b81b-6aea-500a-939a-2ce795aea3ee" include("pyplot.jl")
@require UnicodePlots="b8865327-cd53-5732-bb35-84acbb429228" include("uniplots.jl")
end
Expand Down
54 changes: 27 additions & 27 deletions src/makie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,75 @@

import ColorSchemes

Makie.plot(K::FilledSet;bare=false,args...) = Makie.heatmap(K;bare=bare,args...)
AbstractPlotting.plot(K::FilledSet;bare=false,args...) = AbstractPlotting.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()
@eval function AbstractPlotting.$plt(K::FilledSet;bare::Bool=false,args...)
scene, layout = AbstractPlotting.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)")
AbstractPlotting.Axis(scene,title=String(K),ylabel="Fatou set: z ↦ z-m×f(z)/f'(z)")
else
Makie.Axis(scene,title=String(K))
AbstractPlotting.Axis(scene,title=String(K))
end
plt = Makie.$plt!(ax,K;args...)
layout[1,2] = Makie.Colorbar(scene,plt;width=30)
plt = AbstractPlotting.$plt!(ax,K;args...)
layout[1,2] = AbstractPlotting.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...))
@eval function AbstractPlotting.$plt!(ax,K::FilledSet;bare::Bool=false,args...)
!haskey(args,:colormap) && !isempty(K.meta.cmap) && (return AbstractPlotting.$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...)
AbstractPlotting.$plt!(ax,r1,r2,Z;args...)
else
Makie.$plt!(ax,r1,r2,Z;axis=(title=String(K),),args...)
AbstractPlotting.$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...))
function AbstractPlotting.surface(K::FilledSet;bare::Bool=false,args...)
!haskey(args,:colormap) && !isempty(K.meta.cmap) && (return AbstractPlotting.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...)
AbstractPlotting.surface(reverse(r1),r2,Z;(xreversed=true,)args...)
else
Makie.surface(reverse(r1),r2,Z;axis=(title=String(K),xreversed=true),args...)
AbstractPlotting.surface(reverse(r1),r2,Z;axis=(title=String(K),xreversed=true),args...)
end
end

function Makie.arrows(K::FilledSet;bare::Bool=false,args...)
function AbstractPlotting.arrows(K::FilledSet;bare::Bool=false,args...)
r1,r2 = ranges(K)
Z = transpose(K.set.Ω)
Makie.arrows(r1,r2,real.(Z),imag.(Z);args...)
AbstractPlotting.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")
scene, layout = AbstractPlotting.layoutscene()
ax = layout[1,1] = AbstractPlotting.Axis(scene,title="x ↦ $E$funt")
# plot background lines
plt = [Makie.lines!(ax,x[:],N[:,1];linestyle=:dash),
Makie.lines!(ax,x[:],N[:,2]),
plt = [AbstractPlotting.lines!(ax,x[:],N[:,1];linestyle=:dash),
AbstractPlotting.lines!(ax,x[:],N[:,2]),
# plot orbit cobweb path
Makie.lines!(ax,orbit[:,1],orbit[:,2];color=:red)]
AbstractPlotting.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]))
push!(plt,AbstractPlotting.lines!(ax,x,N[:,h];linewidth=1,color=ColorSchemes.tab10[h>5 ? h-1 : h-2]))
end
if orb0
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)]]
AbstractPlotting.lines!(ax,ran,N2[:];color=:gray,linestyle=:dot,linewidth=1),
AbstractPlotting.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]))
AbstractPlotting.xlims!(ax,bi[1],bi[2])
AbstractPlotting.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
Expand Down

2 comments on commit eac2512

@chakravala
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/38477

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.1.3 -m "<description of version>" eac2512ab8c7d37ce8527aeaff8e140752208871
git push origin v1.1.3

Please sign in to comment.