Skip to content

Commit

Permalink
Merge pull request #200 from macquarrielucas/imaginary-eigenvalue-plot
Browse files Browse the repository at this point in the history
added option for imaginary plotting in plot_eigenvalues
  • Loading branch information
rveltz authored Jan 12, 2025
2 parents a7e184f + f2b6d69 commit 3ce6875
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ext/PlotsExt/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,15 @@ function plot_periodic_shooting(x, M; kwargs...)
plot_periodic_shooting!(x, M; kwargs...)
end
####################################################################################################
function plot_eigenvals(br::AbstractResult, with_param = true; var = :param, k...)
function plot_eigenvals(br::AbstractResult, with_param = true; plot_imag = false, var = :param, k...)
p = getproperty(br.branch, var)
data = mapreduce(x -> x.eigenvals, hcat, br.eig)

values_to_plot = plot_imag ? imag.(data') : real.(data')

if with_param
plot(p, real.(data'); k...)
plot(p, values_to_plot; k...)
else
plot(real.(data'); k...)
plot(values_to_plot; k...)
end
end
end

0 comments on commit 3ce6875

Please sign in to comment.