# How can I plot a list of complex numbers against a parameter while separating their real and imaginary parts?

This is a sort of continuation of How can I make a list of values "remember" the entered parameters?

I have some cubic function which solves for a variable r for different values of a parameter d:

s[d_?NumericQ] :=
SolveValues[r^3 - 10 r^2 + (25 + 100*d^{2}) r - 4 == 0, r]
rvalues =
Join @@ (Transpose /@
Table[{Array[d &, Length[s[d]]], s[d]}, {d, 0, 0.02, 0.001}])


and generates the following list in the form {d,r}

Now I input this list into another function that solves for some eigenvalues where where #[[1]] is the d and #[[2]] is the r:

(0.5 - 0.2 #[[2]] +
PlusMinus[Sqrt[0.01 #[[2]]^2 - #[[1]]^2]]) & /@ rvalues


which generates

I would like to create a scatter plot for this list where the x-variable is d, and the y-variable is the magnitude of the eigenvalues.

I can imagine something like

LambdaRe = ListPlot[{{d_1,lambda_1},...,{d_i,lambda_i}} ];
LambdaIm = ListPlot[{...},PlotStyle->Red];

Show[LambdaRe,LambdaIm]


It is important to note that I want to plot each complex eigenvalue as two separate values, ignoring the imaginary part i and simply plotting each magnitude in a different color or otherwise.

s[d_?NumericQ] := SolveValues[r^3 - 10 r^2 + (25 + 100*d^{2}) r - 4 == 0, r]
eigenfunc[{d_, r_}] := {d, (0.5 - 0.2 r + # Sqrt[0.01 r^2 - d^2])} & /@ {1, -1};

rvalues = Join @@ (Transpose /@
Table[{Array[d &, Length[s[d]]], s[d]}, {d, 0, 0.2, 0.01}]);

eigenvalues = Catenate[eigenfunc /@ rvalues];

ListPlot[{
MapAt[Re, eigenvalues, {All, 2}],
MapAt[Im, eigenvalues, {All, 2}]
}, PlotStyle -> {Blue, Red}, PlotLegends -> {Re, Im}]


• Where do the vertical bars come from?
– ξύλο
Commented Dec 29, 2022 at 20:54
• They come from Around (your PlusMinus). Commented Dec 29, 2022 at 21:05
• The PlusMinus comes from the quadratic formula (used to find the eigenvalues). I didn't mean for it to be the error of the calculation. Is there a way to plot it as such (two values rather than a central value with bars)?
– ξύλο
Commented Dec 29, 2022 at 21:16
• Oh, okay, I have fixed it. Commented Dec 29, 2022 at 21:45