简体   繁体   中英

Discontinuity on a 3D surface

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?

The code I am using is the following:

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()

![图片|690x403](上传://cChwblCgW8nC1CMguozAmDgexeo.png)

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()

曲面图

Any suggestion is very welcome!

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 eg 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM