120120 Ω_range,
121121 branch::Int,
122122 y_offset::String="0.0",
123- y_center::Float64=0.0,
124123 x_scale=1.0,
125124 y_scale=1.0,
126125 logscale=false)
@@ -130,7 +129,7 @@ Performs one matrix diagonalization for each element of `Ω_range`.
130129This method is faster than `plot_response` but results in errors where the noise frequency
131130is far from the frequency of the harmonic variables.
132131"""
133- function plot_jacobian_spectrum (res:: Result , nat_var:: Num ; Ω_range, branch:: Int , y_offset:: String = " 0.0" , y_center :: Float64 = 0.0 , x_scale= 1.0 , y_scale= 1.0 , logscale= false )
132+ function plot_jacobian_spectrum (res:: Result , nat_var:: Num ; Ω_range, branch:: Int , y_offset:: String = " 0.0" , x_scale= 1.0 , y_scale= 1.0 , logscale= false )
134133
135134
136135 length (size (res. solutions)) != 1 && error (" 1D plots of not-1D datasets are usually a bad idea." )
@@ -140,19 +139,20 @@ function plot_jacobian_spectrum(res::Result, nat_var::Num; Ω_range, branch::Int
140139 X = Vector {Float64} (collect (values (res. swept_parameters))[1 ][stability])
141140
142141 offset = Vector {Float64} (getindex .(transform_solutions (res, y_offset), branch))[stability]
143-
142+
144143 # only get spectra of the stable points!
145144 spectra = [JacobianSpectrum (res, branch= branch, index = i) for i in (1 : length (res. solutions))[stability]]
146- Y = Array {Float64, 2} (undef, length (Ω_range), length (X))
145+ C = Array {Float64, 2} (undef, length (Ω_range)- 1 , length (X)- 1 )
147146
148- for ij in CartesianIndices (Y )
149- Y [ij] = abs (evaluate (spectra[ij[2 ]][nat_var], reverse ( Ω_range) [ij[1 ]] - (y_center - offset[ij[2 ]]) ))
147+ for ij in CartesianIndices (C )
148+ C [ij] = abs (evaluate (spectra[ij[2 ]][nat_var], Ω_range[ij[1 ]] - offset[ij[2 ]]))
150149 end
151- X = x_scale .* X
152- Y = logscale ? log .(Y) : Y
153- Ω_range, y_center = y_scale .* Ω_range, y_scale * y_center
154- plt = PyPlot. imshow (Y, aspect= " auto" , extent= [X[1 ], X[end ], Ω_range[1 ]- y_center, Ω_range[end ]- y_center])
150+ x_mat = x_scale * hcat ([x* ones (length (Ω_range)) for x in X]. .. )
151+ y_mat = y_scale * hcat ([Ω_range for j= 1 : length (X)]. .. )
152+ C = logscale ? log .(C) : C
153+
154+ PyPlot. pcolormesh (x_mat, y_mat, C)
155155 xlabel (Latexify. latexify (string (first (keys (res. swept_parameters)))));
156- ylabel (" noise angular frequency - " * y_offset);
157- return plt
156+ ylabel (" noise angular frequency - " * latexify ( y_offset) );
157+ return C
158158end
0 commit comments