How to Plot Complex Numbers in Python?


You can plot complex numbers on a polar plot. If you have an array of complex numbers, you can plot it using:

import matplotlib.pyplot as plt
import numpy as np

cnums = np.arange(5) + 1j * np.arange(6,11)
X = [x.real for x in cnums]
Y = [x.imag for x in cnums]
plt.scatter(X,Y, color='red')
plt.show()

This will plot a graph of the numbers in a complex plane.

Updated on: 18-Jun-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements