Plotting
Plotting branches
Plotting is provided by calling Plots.jl
. It means that to plot a branch br
, you just need to call
plot(br)
where br
is a branch computed after a call to br, = continuation(...)
. You can use the keywords provided by Plots.jl
and the different backends. You can thus call
scatter(br)
plot!(br, branchlabel = "continuous line")
The available arguments specific to our plotting methods are
plotfold = true
: plot the fold points with black dotsputspecialptlegend = true
: display the legend corresponding to the bifurcation pointsvars = nothing
: see belowplotstability = true
: display the stability of the branchplotspecialpoints = true
: plot the special (bifurcation) points on the branchbranchlabel = "fold branch"
: assign label to a branch which is printed in the legendlinewidthunstable
: set the linewidth for the unstable part of the branchlinewidthstable
: set the linewidth for the stable part of the branchplotcirclesbif = false
use circles to plot bifurcation pointsapplytoX = identity
apply transformationapplytoX
to x-axisapplytoY = identity
apply transformationapplytoY
to y-axis
If you have severals branches br1, br2
, you can plot them in the same figure by doing
plot(br1, br2)
in place of
plot(br1)
plot!(br2)
The bifurcation points for which the bisection was successful are indicated with circles and with squares otherwise.
Choosing Variables
You can select which variables to plot using the keyword argument vars
, for example:
plot(br, vars = (:param, :x))
The available symbols are :x, :param, :itnewton, :itlinear, :ds, :θ, :n_unstable, :n_imag, :stable, :step
,... and:
x
ifrecordFromSolution
(seecontinuation
) returns aNumber
.x1, x2,...
ifrecordFromSolution
returns aTuple
.- the keys of the
NamedTuple
returned byrecordFromSolution
.
The available symbols are provided by calling propertynames(br.branch)
.
Plotting directly using the field names
You can define your own plotting functions using the internal fields of br
which is of type ContResult
. For example, the previous plot can be done as follows:
plot(br.branch.param, br.branch.x)
You can also have access to the stability of the points by using br.stable
. More information concerning the fields can be found in ContResult
.
You can also plot the spectrum at a specific continuation step::Int
by calling
# get the eigenvalues
eigvals = br.eig[step].eigenvals
# plot them in the complex plane
scatter(real.(eigvals), imag.(eigvals))
Plotting bifurcation diagrams
To do this, you just need to call
plot(diagram)
where diagram
is a branch computed after a call to diagram = bifurcationdiagram(...)
. You can use the keywords provided by Plots.jl
and the different backends. You can thus call scatter(diagram)
. In addition to the options for plotting branches (see above), there are specific arguments available for bifurcation diagrams
code
specify the part of the bifurcation diagram to plot. For examplecode = (1,1,)
plots the part after the first branch of the first branch of the root branch.level = (-Inf, Inf)
restrict the branching level for plotting.