Skip to content

Commit e6482d6

Browse files
committed
correction of plot_DCont_branch
1 parent 2f5c098 commit e6482d6

File tree

5 files changed

+37
-24
lines changed

5 files changed

+37
-24
lines changed

ext/GLMakieExt/GLMakieExt.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ module GLMakieExt
2121
get_color,
2222
colorbif,
2323
get_plot_backend,
24-
BK_Makie
24+
BK_Makie,
25+
plotAllDCBranch,
26+
plot_DCont_branch
2527

2628
# TODO block precompilation
2729
get_plot_backend() = BK_Makie()

ext/GLMakieExt/plot.jl

+10-1
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,13 @@ function _plot_bifdiag_makie!(ax, bd::Vector{BifDiagNode}; code = (), level = (-
239239
_plot_bifdiag_makie!(ax, b; code, level, k... )
240240
end
241241
end
242-
####################################################################################################
242+
####################################################################################################
243+
plotAllDCBranch(branches) = plot(branches...)
244+
245+
function plot_DCont_branch(::BK_Makie,
246+
branches,
247+
nbrs::Int,
248+
nactive::Int,
249+
nstep::Int)
250+
plot(branches...)
251+
end

ext/PlotsExt/PlotsExt.jl

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ module PlotsExt
1616
_hasstability,
1717
filter_bifurcations,
1818
get_color,
19-
AbstractResult
19+
AbstractResult,
20+
BK_NoPlot, BK_Plots,
21+
plotAllDCBranch,
22+
plot_DCont_branch
2023

2124
include("plot.jl")
2225
end

ext/PlotsExt/plot.jl

+17
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,24 @@ function plot_branch_cont(contres::ContResult,
4141
label = "",
4242
subplot = 2) |> display
4343
end
44+
####################################################################################################
45+
plotAllDCBranch(branches) = display(plot(branches..., label = ""))
4446

47+
function plot_DCont_branch(::Union{BK_Plots, BK_NoPlot},
48+
branches,
49+
nbrs::Int,
50+
nactive::Int,
51+
nstep::Int)
52+
plot(branches...; label = "", title = "$nbrs branches, actives = $(nactive), step = $nstep")
53+
for br in branches
54+
(length(br) > 1) && plot!([br.branch[end-1:end].param],
55+
[getproperty(br.branch,1)[end-1:end]],
56+
label = "", arrow = true, color = :red)
57+
end
58+
scatter!([br.branch[1].param for br in branches],
59+
[br.branch[1][1] for br in branches],
60+
marker = :cross, color=:green, label = "") |> display
61+
end
4562
####################################################################################################
4663
# plotting function of the periodic orbits
4764
function plot_periodic_potrap(x, M, Nx, Ny; ratio = 2, kwargs...)

src/DeflatedContinuation.jl

+3-21
Original file line numberDiff line numberDiff line change
@@ -166,26 +166,8 @@ function get_states_contResults(iter::DefContIterable, roots::Vector{Tvec}) wher
166166
end
167167

168168
# plotting functions
169-
function plot_DCont_branch(branches,
170-
nbrs::Int,
171-
nactive::Int,
172-
nstep::Int)
173-
_bcd_plot = get_plot_backend()
174-
if _bcd_plot == BK_Plots()
175-
plot(branches...; label = "", title = "$nbrs branches, actives = $(nactive), step = $nstep")
176-
else
177-
plot(branches...)
178-
end
179-
for br in branches
180-
(length(br) > 1 && _bcd_plot == BK_Plots()) && plot!([br.branch[end-1:end].param],
181-
[getproperty(br.branch,1)[end-1:end]],
182-
label = "", arrow = true, color = :red)
183-
end
184-
_bcd_plot == BK_Plots() && scatter!([br.branch[1].param for br in branches],
185-
[br.branch[1][1] for br in branches],
186-
marker = :cross, color=:green, label = "") |> display
187-
end
188-
plotAllDCBranch(branches) = display(plot(branches..., label = ""))
169+
function plotAllDCBranch end
170+
function plot_DCont_branch end
189171

190172

191173
"""
@@ -316,7 +298,7 @@ function deflatedContinuation(dcIter::DefContIterable,
316298
# number of active branches
317299
nactive = mapreduce(isactive, +, dcstates)
318300
if plot && mod(nstep, contParams.plot_every_step) == 0
319-
plot_DCont_branch(branches, nbrs, nactive, nstep)
301+
plot_DCont_branch(get_plot_backend(), branches, nbrs, nactive, nstep)
320302
end
321303

322304
# only look for new branches if the number of active branches is too small

0 commit comments

Comments
 (0)