Search code examples
pythonmatplotlibcomplex-numbers

How can I plot a complex numered list into complex plane?


[(-1.9984848484848483-0.05681818181818188j),
 (-1.9984848484848483-0.03409090909090917j),
 (-1.9984848484848483-0.011363636363636243j),
 (-1.9984848484848483+0.011363636363636465j),
 (-1.9984848484848483+0.03409090909090917j)]

How can I plot something like this into the complex plane in python using matplotlib?


Solution

  • You can wrap the list into a numpy array, then scatter plot with real and imag components:

    zs = np.array([(-1.9984848484848483-0.05681818181818188j),
     (-1.9984848484848483-0.03409090909090917j),
     (-1.9984848484848483-0.011363636363636243j),
     (-1.9984848484848483+0.011363636363636465j),
     (-1.9984848484848483+0.03409090909090917j)])
    
    plt.scatter(zs.real, zs.imag)
    

    Resulting in:

    enter image description here