A cardioid is the plane figure described in polar coordinates by $r = 2a(1+\cos\theta)$ for $0 \le \theta \le 2\pi$:
theta = pylab.linspace(0, 2.*pylab.pi, 1000)
a = 1.
r = 2 * a * (1. + pylab.cos(theta))
pylab.polar(theta, r)
pylab.show()
The polar graph plotted by this code is illustrated below.