本文介绍了3D 表面的不连续性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用散点图和曲面图绘制 3D 分布的数据.从以下片段中可以看出,尽管散点图没有显示任何缺失的数据集,但我在使用曲面图时遇到了不连续性.是否有我忽略的参数/选项?

I am plotting data of a 3D distribution both with the scatter and the surface plot. As it is possible to see from the following snippets, I am experiencing a discontinuity using the surface plot although the scattered plot doesn't show any missing set of data. Is there a parameter/option I am overlooking at?

我使用的代码如下:

fig = go.Figure(data=[go.Scatter3d(x=x, y=y, z=z,
                                   mode='markers',
                                   marker=dict(size=5,
                                               color=d,            # set color to an array/list of desired values
                                               colorscale='Viridis', # choose a colorscale
                                               opacity=1.,
                                               showscale=True          # to show the legend according to the color
                                               )
                                      )])

fig.update_layout(title='TFMeOx MFPADs theory scattered',margin=dict(l=0, r=0, b=0, t=0))
fig.show()
fig = go.Figure(data=[go.Surface(z=Z, x=X, y=Y, surfacecolor=d_matrix)])
fig.update_layout(title='TFMeOx MFPADs theor surfy', autosize=False,
                #   width=500, height=500,
                #   margin=dict(l=65, r=50, b=65, t=90))
                  margin=dict(l=0, r=0, b=0, t=0))
fig.show()

非常欢迎任何建议!

推荐答案

如果你从 x,y,z 绘制一个曲面,你必须告诉绘图软件哪些点构成了基本部分(如三角形或四边形)弥补你的大面积.

If you plot a surface from x,y,z you have to tell the plotting software which points form the elementary parts (like a triangle or a quadrilateral) that make up your large surface.

通常有一些聪明的东西可以从点列表或类似的东西中猜测元素.有时你必须传递表面数组的形状.

Usually there is something smart im place to guess the elements from a point list or the like . Sometimes you have to pass the shape of the surface array.

但重点是算法不知道如何处理列表中的最后一个点.它不知道它们连接到例如第一点.它将假定它们没有连接.

But the point is that the algorithm does not know how to handle the last points in the list. It does not know that they are connected to e.g. the first points. It will assume that they are not connected.

您的绘图函数中可能有一个选项,但通常您只需将列表中第一个点的副本附加到末尾.

There might be a option in your plotting function for this, but usually you just append copies of the first points at the list to the end.

(函数的文档显示了一个关键字connectgaps,但这可能无法解决这个问题.)

(The documentation to the function shows a keyword connectgaps, but that might not solve this.)

这篇关于3D 表面的不连续性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 12:12