python - 来自 3D 数据 python 的 2D 热图
问题描述
我正在尝试从 3d 数据集生成 2D 热图/强度图,例如
x, y, z:
0 0 2
1 0 4
1 1 2
2 0 3
2 1 4 ..
其中 (x,y) 是网格点,z 是我的函数 z = f(x,y) 的幅度。到目前为止,我已经将其可视化为 3d+heatmap 通过
ax = plt.axes(projection="3d")
ax.scatter3D ( x,y z, c=z, cmap ="hsv")
我现在想使用带有热图的二维图来可视化这一点。我努力了
sc = plt.scatter(x,y, c=z, cmap ="hsv")
cbar = fig.colorbar(sc)
plt.show()
然而,我的 90% 的 z 值分布在 0 附近,其余的则显示我感兴趣的结构。使用散点图,10% 完全被构成背景的 90% 所掩盖。我怎样才能更有效地可视化这样的 3D 数据集,其中大部分数据分布在某个均值附近,而我对偏离均值的数据点感兴趣?
解决方案
您可能正在寻找等高线类型的图。看看是不是你要找的:
情节库:https ://plotly.com/python/contour-plots/
Matplotlib 库:https ://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.contour.html
推荐阅读
- kotlin - Kotlin 协程:通道与流
- angular - 如何在 Angular 应用程序的 environment.prod.ts 中动态配置与后端的连接?
- printing - CUPS 作业不再显示在 Web UI 上
- c++ - 在 Direct3D 12 中的描述符范围内设置多个描述符
- r - 使用 rmarkdown + plotly 轴标题与轴刻度重叠
- spring-cloud-dataflow - Spring Cloud 数据流自定义应用属性
- vb.net - 对输入的数字进行测验
- laravel - 如何渴望加载多态关系的不同嵌套关系?
- google-cloud-platform - 如何在谷歌云上部署播放应用程序
- c# - 将字段添加到 ac# 嵌入式不和谐消息