我想画画x=0
and y=0
等高线图中的轴,使用白色。如果这太麻烦了,我想要一个白点来表示原点在哪里。
我的等高线图如下所示,下面给出了创建它的代码。
xvec = linspace(-5.,5.,100)
X,Y = meshgrid(xvec, xvec)
fig = plt.figure(figsize=(6, 4))
contourf(X, Y, W,100)
plt.colorbar()
有多种选择(例如中心刺 http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html),但就你而言,最简单的方法就是使用axhline http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=axvline#matplotlib.pyplot.axvline and axvline http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=axvline#matplotlib.pyplot.axhline.
E.g.
import numpy as np
import matplotlib.pyplot as plt
xvec = np.linspace(-5.,5.,100)
x,y = np.meshgrid(xvec, xvec)
z = -np.hypot(x, y)
plt.contourf(x, y, z, 100)
plt.colorbar()
plt.axhline(0, color='white')
plt.axvline(0, color='white')
plt.show()
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)