首页 > 解决方案 > mplot3d Axes3D.contour()中参数stride的意义是什么?

问题描述

Axes3D.contourmplot3d 中的函数具有以下参数 - stride。定义说-扩展轮廓的步长- 这对我来说并没有说明问题。我正在使用 $z=x^2+y^2$ 来查看轮廓。我想stride只能与另一个参数一起使用extend3d,它会沿着 z 拉伸轮廓。您能否参考下面的示例代码解释一下它到底做了什么?

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
from matplotlib import cm
%matplotlib notebook
x = np.linspace(-1,1,100)
X,Y = np.meshgrid(x,x)
Z = X**2 + Y**2
ax = plt.figure().add_subplot(projection='3d')
ax.contour(X,Y,Z,stride=10,extend3d=True,cmap=cm.coolwarm)

阴谋

标签: matplotlibcontourmplot3d

解决方案


推荐阅读