I try to plot (ReE,ImE) graph, here E = Re[E] + iIm[E] are the complex eigenvalues of a matrix H.
However, in this code, the plotting is colored by some default color.
I want to plot each (ReE,ImE) by coloring with blue gradation according to the value of the norm of eigenvector of E.
What should I do?
using LinearAlgebra
using CairoMakie
using AlgebraOfGraphics
H = rand(-10:10, 40, 40)
λ, v = eigen(H)
draw(mapping([real(λ)] => "Re", [imag(λ)] => "Im", color=[abs.(λ)] => "Magnitude") *
visual(colormap=:blues),
axis=(width=300, height=200))
This is using the magnitude of the eigenvalues (the eigenvectors returned by eigen all have norm 1, and for every eigenvector \vec{v} and k\neq 0 the vector k\vec{v} is also an eigenvector so I’m not sure why you would want to plot the eigenvector norms?).
Edit: and with simple Makie:
using LinearAlgebra, CairoMakie
H = rand(-10:10, 40, 40)
λ, v = eigen(H)
scatter(real(λ), imag(λ), color=abs.(λ), colormap=:blues)
But the same is true of any matrix: although not documented I think, eigen always returns normalized eigenvectors.
Well there’s probably a matrix type out there that specializes eigen and returns non-normalized vectors, but even so it seems like a detail of the implementation with no mathematical meaning…