【问题标题】:2D Heatmap from 3D data python来自 3D 数据 python 的 2D 热图
【发布时间】:2021-12-19 20:03:11
【问题描述】:

我正在尝试使用例如从 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")

我现在想使用带有热图的 2d 绘图来可视化这一点。我试过了

sc = plt.scatter(x,y, c=z, cmap ="hsv")
cbar = fig.colorbar(sc)
plt.show()

但是,我 90% 的 z 值分布在 0 附近,其余的则显示我感兴趣的结构。使用散点图,10% 完全被构成背景的 90% 所掩盖。我怎样才能更有效地可视化这样一个 3D 数据集,其中大部分数据都分布在某个均值附近,而我对偏离均值的数据点感兴趣?

【问题讨论】:

    标签: python 3d heatmap colormap


    【解决方案1】:

    您可能正在寻找等高线类型的图。看看是不是你要找的:

    绘图库:https://plotly.com/python/contour-plots/

    Matplotlib 库:https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.contour.html

    【讨论】:

      猜你喜欢
      • 2013-08-29
      • 1970-01-01
      • 2020-03-13
      • 2017-06-17
      • 2015-09-27
      • 1970-01-01
      • 1970-01-01
      • 2017-09-04
      • 1970-01-01
      相关资源
      最近更新 更多