# matplotlib contourplot for $\log z$ in the Complex Plane $\mathbb{C}$

I tried using Python's matplotlib on the logarithm and here is what I got, a kind of starburst pattern. Since the angle jumps between $\theta = 0$ and $\theta = 2\pi$, contour assumes there is a contour line between those those two points. Here in in fact $\bbox[#EEEDAA,1pt]{0=2\pi}$

Perhaps instead of matplotlib.pyplot.contour the contour lines can be connected with meshgrid and numpy.where statements.

## Contour Plot of $\log z$ on $z \in [-1,1] + i[-1,1]$

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize']=4,4

plt.contour(
np.arange(-1,1,0.01),
np.arange(-1,1,0.01),
np.angle(t[...,None] + 1j*t[None,...]) ,
levels = 2*np.pi*np.arange(-1,1,0.025)
)


## Contour Lines Accumulate at the Negative Imaginary Axis $-i \, \mathbb{R}_{\geq 0}$

t = np.arange(-1,1,0.025)
plt.contour(t,t, np.angle(t[...,None] + 1j*t[None,...]) , levels = 2*np.pi*np.arange(-1,1,0.025))

L = 0.25
plt.xlim([-L,L])
plt.ylim([-L,L])


## Code Inspection

import inspect
print inspect.getsource(plt.contour)

@_autogen_docstring(Axes.contour)
def contour(*args, **kwargs):
ax = gca()
# allow callers to override the hold state by passing hold=True|False
washold = ax.ishold()
hold = kwargs.pop('hold', None)
if hold is not None:
ax.hold(hold)
try:
ret = ax.contour(*args, **kwargs)
draw_if_interactive()
finally:
ax.hold(washold)
if ret._A is not None: sci(ret)
return ret


print inspect.getsource(plt.Axes.contour)

def contour(self, *args, **kwargs):
if not self._hold:
self.cla()
kwargs['filled'] = False
return mcontour.QuadContourSet(self, *args, **kwargs)


Finally one can call on the function containing the actual source code:

import matplotlib