Skip to content

Commit

Permalink
added option for imaginary plotting in plot_eigenvalues
Browse files Browse the repository at this point in the history
  • Loading branch information
macquarrielucas authored Jan 12, 2025
1 parent a7e184f commit f2b6d69
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...)

Check warning on line 103 in ext/PlotsExt/plot.jl

View check run for this annotation

Codecov / codecov/patch

ext/PlotsExt/plot.jl#L103

Added line #L103 was not covered by tests
p = getproperty(br.branch, var)
data = mapreduce(x -> x.eigenvals, hcat, br.eig)

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

Check warning on line 107 in ext/PlotsExt/plot.jl

View check run for this annotation

Codecov / codecov/patch

ext/PlotsExt/plot.jl#L107

Added line #L107 was not covered by tests

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

Check warning on line 110 in ext/PlotsExt/plot.jl

View check run for this annotation

Codecov / codecov/patch

ext/PlotsExt/plot.jl#L110

Added line #L110 was not covered by tests
else
plot(real.(data'); k...)
plot(values_to_plot; k...)

Check warning on line 112 in ext/PlotsExt/plot.jl

View check run for this annotation

Codecov / codecov/patch

ext/PlotsExt/plot.jl#L112

Added line #L112 was not covered by tests
end
end
end

0 comments on commit f2b6d69

Please sign in to comment.