matplotlib - 使用 matplotlib 在 Python 中绘制曲面
问题描述
我尝试使用 matplotlib plot_surface 函数绘制曲面。但是,该图看起来不像数据。我认为有太多的零值。有人知道为什么吗?这是一个最小的例子:
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d')
acc = 6
theta = np.linspace(0, 2 * np.pi, acc)
r = np.linspace(1e-9, 1e-6, acc)
vel = np.array([[-0.00000000e+00, -6.96917563e+17, -2.66198006e+17, 2.66198006e+17,
6.96917563e+17, 0.00000000e+00],
[-0.00000000e+00, -1.72873106e+13, -6.59910496e+12, 6.59910496e+12,
1.72873106e+13, 0.00000000e+00],
[-0.00000000e+00, -4.34416586e+12, -1.65728837e+12, 1.65728837e+12,
4.34416586e+12, 0.00000000e+00],
[-0.00000000e+00, -1.93428451e+12, -7.37472774e+11, 7.37472774e+11,
1.93428451e+12, 0.00000000e+00],
[-0.00000000e+00, -1.08912583e+12, -4.14989889e+11, 4.14989889e+11,
1.08912583e+12, 0.00000000e+00],
[-0.00000000e+00, -6.97507012e+11, -2.65608352e+11, 2.65608352e+11,
6.97507012e+11, 0.00000000e+00]])
theta, r = np.meshgrid(theta, r)
surf = ax.plot_surface(r, theta, vel)
plt.show()
它给了我这个情节:
PS:对不起,我还不能嵌入图片
解决方案
推荐阅读
- c - 写入空白索引值的向量
- c# - 如何使用 asp.net core 2.0 Razor 页面执行下载操作
- java - 在 eclipse 中以 -h name 格式传递示例命令行参数
- javascript - 如何让Vue Filter递归?
- html - 从静态 HTML 站点重定向到 Wordpress 的最快/最安全方式(新域,具有一些永久链接结构更改)
- angular - 带三元运算符的角 loadChildren
- angular - 如何解决我从 NPM 安装中遇到的错误问题
- jestjs - 在 Jest 中禁用“您的测试套件必须包含至少一个测试”规则
- angular - 动态创建和读取全局变量
- html - 垂直对齐元素,上方 1/3 空间下方 2/3 空间