Skip to content

Commit

Permalink
upgraded Makie, deprecated AbstractPlotting
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Nov 11, 2021
1 parent 4146c66 commit 461e339
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.4"
version = "1.1.5"

[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 AbstractPlotting="537997a7-5e4e-5d89-9595-2241ea00577e" include("makie.jl")
@require Makie="ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" 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

AbstractPlotting.plot(K::FilledSet;bare=false,args...) = AbstractPlotting.heatmap(K;bare=bare,args...)
Makie.plot(K::FilledSet;bare=false,args...) = Makie.heatmap(K;bare=bare,args...)

for plt (:contour,:contourf,:heatmap)
plt! = Symbol(plt,:!)
@eval function AbstractPlotting.$plt(K::FilledSet;bare::Bool=false,args...)
scene, layout = AbstractPlotting.layoutscene()
@eval function Makie.$plt(K::FilledSet;bare::Bool=false,args...)
scene, layout = Makie.layoutscene()
ax = layout[1,1] = if K.meta.newt
AbstractPlotting.Axis(scene,title=String(K),ylabel="Fatou set: z ↦ z-m×f(z)/f'(z)")
Makie.Axis(scene,title=String(K),ylabel="Fatou set: z ↦ z-m×f(z)/f'(z)")
else
AbstractPlotting.Axis(scene,title=String(K))
Makie.Axis(scene,title=String(K))
end
plt = AbstractPlotting.$plt!(ax,K;args...)
layout[1,2] = AbstractPlotting.Colorbar(scene,plt;width=30)
plt = Makie.$plt!(ax,K;args...)
layout[1,2] = Makie.Colorbar(scene,plt;width=30)
return scene
end
@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...))
@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
AbstractPlotting.$plt!(ax,r1,r2,Z;args...)
Makie.$plt!(ax,r1,r2,Z;args...)
else
AbstractPlotting.$plt!(ax,r1,r2,Z;axis=(title=String(K),),args...)
Makie.$plt!(ax,r1,r2,Z;axis=(title=String(K),),args...)
end
end
end # center!(scene)

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...))
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
AbstractPlotting.surface(reverse(r1),r2,Z;(xreversed=true,)args...)
Makie.surface(reverse(r1),r2,Z;(xreversed=true,)args...)
else
AbstractPlotting.surface(reverse(r1),r2,Z;axis=(title=String(K),xreversed=true),args...)
Makie.surface(reverse(r1),r2,Z;axis=(title=String(K),xreversed=true),args...)
end
end

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

2 comments on commit 461e339

@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/48636

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.5 -m "<description of version>" 461e3393216289640b9f0a8ab12b183d4fe8b7c9
git push origin v1.1.5

Please sign in to comment.