如何平滑一组 3D 点?

发布于 2024-11-29 18:33:20 字数 322 浏览 1 评论 0原文

这个问题是我上一个问题的扩展,您可以在这里找到:

如何在 python 中绘制数据立方体

问题是我有一个 3D 点图,但如果我遵循上一个问题的方法,当我有太多要绘制的点时,我可能会收到溢出错误。 我必须绘制数百万个点,因此我需要平滑 3D 分布,否则需要花费大量时间来绘制图,并且还可能出现内存错误。

我在想也许我可以用高斯核对分布进行卷积,但我不知道这是否是最好的选择。而且,我现在还做不到。

this question is an extension of my previous question that you can find here:

How to plot a data cube in python

The thing is that I have a 3D plot of point but if I follow the method of my previous question I could get an overflow error when I have too many points to plot.
I have to plot millions of points so I need to smooth the 3D distribution, otherwise it takes a huge amount of time to make the plot and I could also get memory errors.

I was thinking that maybe I can convolve the distribution with a Gaussian kernel, but I don't know if it's the best option. Moreover, I am not able to do it yet.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜中书 2024-12-06 18:33:20

正如我在原始问题中回答的那样, Dots 图对您有好处。它由 MathGL - GPL 绘图库生成。添加如果以位图格式(PNG、JPEG、GIF 等)保存,则不需要太多内存。

然而,还有另一种选择可以平滑自身:
(i) 制作点分布的直方图(即某个单元格内的平均点值或颜色)——在 MathGL 框架中,即使对于 3D 空间中的点,您也可以使用 Hist() 函数;或者
(ii) 使用标准平滑函数(如 MathGL 中的 mglData::Smooth()),但这里需要使用常规数组,即 {x[i,j,k], y[i,j,k], z [i,j,k], c[i,j,k]}。

两种变体都会为您提供可以通过一组不同方式绘制的常规数组 - 请参阅这些示例< /a>.

As I answered in original question, the Dots plot is good for you. It is produced by MathGL -- GPL plotting library. Add it don't need many memory if you save in bitmap format (PNG, JPEG, GIF and so on).

However, there are another option for smoothing itself:
(i) make histogram of point distribution (i.e. average points values or colors inside some cell) -- in frame MathGL you can use Hist() function even for points in 3D space; or
(ii) using standard smoothing functions (like mglData::Smooth() in MathGL), but here you need to use regular arrays, i.e. as {x[i,j,k], y[i,j,k], z[i,j,k], c[i,j,k]}.

Both variant will give you regular arrays which can be plotted by a set of different ways -- see these samples.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文