python - 颤动的 matplotlib 向量场 3d 绘图错误:“解包的值太多”
问题描述
以下代码不起作用并给我错误:“解包的值太多”。我从以下网站获得了直接尝试的代码:https ://matplotlib.org/gallery/mplot3d/quiver3d.html ,所以我不知道出了什么问题。显然我的所有库都已正确安装,因为我没有收到任何错误。
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d')
# Make the grid
x, y, z = np.meshgrid(np.arange(-0.8, 1, 0.2),
np.arange(-0.8, 1, 0.2),
np.arange(-0.8, 1, 0.8))
# Make the direction data for the arrows
u = np.sin(np.pi * x) * np.cos(np.pi * y) * np.cos(np.pi * z)
v = -np.cos(np.pi * x) * np.sin(np.pi * y) * np.cos(np.pi * z)
w = (np.sqrt(2.0 / 3.0) * np.cos(np.pi * x) * np.cos(np.pi * y) *
np.sin(np.pi * z))
ax.quiver(x, y, z, u, v, w, length=0.1, normalize=True)
plt.show()
解决方案
推荐阅读
- javascript - 如何在地图函数中进行异步查询?- 猫鼬
- r - 如何将数据框列表合并到一个奇异矩阵中?
- label - graphviz:有没有办法禁用 1/ 子图或 2/ 标签?
- spring - 分布式应用程序的多个搜索位置(Spring Cloud Config)
- r - for循环后无法使用闪亮的数据
- angular - Angular - OAuth - 加载两次或两次重定向 - 如何停止重新加载/刷新
- python - dnspython2-如何创建/编辑 DNS A 记录
- r - 如何用另一个变量上的 ID 持有者的分数替换参与者 ID
- c# - 即使在 WinForms 中停用后,如何将子窗体保留在屏幕上?
- sql - postgresql 条件最大值来自每个组 id 之间的最后五个记录