在matplotlib 3D绘图中,函数plot_wireframe
分别采用参数- rcount
、ccount
、rstride
和cstride
。我浏览了matplotlib documentation中的文档,但不是很清楚他们做了什么。我稍微更改了一下rcount
和ccount
的参数值,有一种感觉,那就是网格X和Y中有多少行和多少列用于放置导线(X和Y是plot_wireframe
的网格输入)。我猜在理解了rcount和ccount之后,就会对rstride和cstride有一个清晰的理解。因此,我要求用一个例子来更好地解释这一点。
这是我的代码供参考(在Jupyter notebook中运行)-
import numpy as np
import matplotlib.pyplot as plt
# Because I would want to rotate the plots manually
%matplotlib notebook
x = np.linspace(-3,3,7)
y = np.linspace(-3,3,7)
X,Y = np.meshgrid(x,y)
Z = X**2 + Y**2
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.plot_wireframe(X,Y,Z,rcount=3, ccount=5)
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
发布于 2021-05-11 09:57:48
表达同一件事的两种方式。假设你有1000x1000分。如果指定rcount=10
和ccount=50
,它将对数据进行下采样,以便绘制10行和50列。如果你说的是rstride=10
和cstride=50
,那么将在行中取每10个点,在列中取每50个点。
因此,对于1000x1000,rcount=10
与rstride=100
相同。它们是相互排斥的,显然,您并不是真的需要两者。
https://stackoverflow.com/questions/67479553
复制相似问题