我发现在matplotlib中手动选择轮廓标签会为绘图添加额外的线条。此外,轮廓标签从局部切线旋转到轮廓线。例如,以下代码
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
#Define surface
delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)
#Plot surface
plt.figure()
CS = plt.contour(X, Y, Z)
#Manually pick labels
CS.clabel(CS.levels, manual = True, inline = True)
在轮廓线上点击鼠标,结果如下:
任何人都知道我做错了什么?也许这是一个轴转换错误......
如果重要,我正在运行matplotlib 1.3.0和python 2.7.5