# How to Plot Complex Numbers in Python?

PythonProgramming

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.

Published on 20-Apr-2018 08:51:30