Black Lives Matter. Please consider donating to Black Girls Code today.

Mesh3d Generating Inaccurate Meshes

Hi, I have noticed some strange behavior using both ployly.js and plotly.py, and was wondering if anyone had suggestions on how I might fix it…

When I attempt to plot my particular dataset with Mesh3d, it does render the Mesh, but it also shows a few surfaces that shouldn’t be there - particularly around the edges of the plot, connecting one corner to the another.

The below images showcase this issue (generated via plotly.py) - notice the two edges highlighted and the extra planes that are created connecting the corners (mesh should follow the black dots):

I also attempted to build a similar mesh directly on Plotly online, and had better success - the link here is the working plotly online version of a similar dataset / plot.

Below is the python code and dataset I am using to generate the plot (note I am seeing the exact same issue when running plotly.js as well):

Sample Mesh Data Here (test_data_surf.spd)

from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly
import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np

pts=np.loadtxt('test_data_surf.spd',skiprows=1)
x,y,z=zip(*pts)

trace1 = go.Mesh3d(x=x,y=y,z=z,color='90EE90',opacity=0.5,showscale=False) 
trace2 = go.Scatter3d(x=x,y=y,z=z,mode='markers',marker=dict(color='rgb(0, 0, 0)',size=2,opacity=0.6))

data = [trace1,trace2]
fig = go.Figure(data=data)
plot(fig, filename="graph_py.html", auto_open=False,show_link=False)

Any suggestions on what may be causing this issue?

Thanks,
Matthew

The link here is a live version of the issue I am seeing (this one generated using plotly.js):

http://dev.parallel.works/dakota_graphs/surfpack.html

Thanks for writing in.

It this result correct? Or just better?

Plotly online, plotly.py and plotly.js all use the same plotting code (that is plotly.js) to render graphs. Maybe something is up with your dataset.

Thanks for the response etienne…

I just retried to generate the same graph using Plotly online, and it actually appears to be generating the same error.

The online graph is here: https://plot.ly/~mattshax/18/

Image of the graph on Plotly online is below (drew red areas on the problem area):

If is it something with my dataset, do you have suggestions on how to best fix it? I have noticed these rogue surfaces appearing on multiple similar datasets.

Thanks,
Matthew

Thanks for the link.

I’ll examine it and see whether it’s our fault (or yours).

Thanks for using plotly!

Hi etienne, just wondering if you were able to find anything out about this issue?

Thanks,
Matthew

I looked at it briefly and nothing abnormal stuck out.

Have you tried plotting the same data set with a different graphing library?

All these demos look fine to me:
4x4 grid
5x4 grid
4x5 grid
@mattshax would you mind finding the minimal dataset that cause this problem?