matplotlib在3D中轮廓标签

时间:2015-10-14 10:18:37

标签: python matplotlib 3d

有没有办法在3D图中放置轮廓标签? Clabel显然没有在3D中实现

import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

x,y = np.meshgrid(np.linspace(-1,1,10),np.linspace(-1,1,10))
z=-(x**2+y**2)

fig,ax = plt.subplots()
C=ax.contour(x,y,z)
ax.clabel(C)

fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')
C=ax.contour(x,y,z,zdir='z',offset=-2)
ax.clabel(C)

enter image description here enter image description here

1 个答案:

答案 0 :(得分:0)

作为clabel is not implemented并且返回值为None,暂时调用clabel()确实没有意义。您可以将C.levels属性用于manually add labels to the graph

虽然它不会有很好的inline功能隐藏标签下的轮廓。

相关问题