0
$\begingroup$

Assuming I have a list like:

{{1, 1. - 0.0169212 I}, {2, 0.99611 + 0.0326189 I},
 {3,1.02048 + 0.0945609 I}, {4, 1.02722 + 0.138977 I}}

When I try now

ListPlot[Im[List]]

I got points only on $x=0$, since the imaginary part of all the "$x$-points" is zero. How can I plot what is really meant by the command above? So that only the second entry of the tuple get's the Im.

$\endgroup$
2
  • 1
    $\begingroup$ 2 things: 1) Call your list list, not List 2) since your x-coords are 1,2,3,4..., list[[All, 2]] // Im // ListPlot will work - otherwise use @AlexeiBoulbitch 's solution $\endgroup$
    – martin
    Nov 30 '15 at 11:27
  • $\begingroup$ Take a look at MapAt. $\endgroup$
    – Kuba
    Nov 30 '15 at 12:12
8
$\begingroup$

Try this:

ListPlot[lst /. {x_, y_} -> {x, Im[y]}]

returning this:

enter image description here

Have fun!

$\endgroup$
1
$\begingroup$

Data:

{{1, 1. - 0.0169212 I}, {2, 0.99611 + 0.0326189 I}, {3, 1.02048 + 0.0945609 I}, {4, 1.02722 + 0.138977 I}};

Operation:

ListPlot[Im[%[[All, 2]]]]

Output:

Output visual representation

Reference:

ListPlot
%
[[]]

$\endgroup$
0
$\begingroup$
w={{1, 1. - 0.0169212 I}, {2, 0.99611 + 0.0326189 I},{3,1.02048 + 0.0945609 
  I}, {4, 1.02722 + 0.138977 I}};
f[w_] := w /. {a_, b_} :> {a, Im[b]};
list = f@w
ListPlot[list]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.