我尝试在对数上使用 Python 的 matplotlib,这就是我得到的,一种星爆模式。由于角度在和, 轮廓假设这两个点之间有一条轮廓线。这里实际上是
或许可以用和语句来代替matplotlib.pyplot.contour
轮廓线。meshgrid
numpy.where
在上的等高线图
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)
)
等高线在负虚轴处累积
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])
代码检查
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)
最后可以调用包含实际源代码的函数:
import matplotlib
print inspect.getsource(matplotlib.contour.QuadContourSet)