Skip to content

Mesh3d does not reproduce scatter3d - alphahull issue? #2621

@PhilW1952

Description

@PhilW1952

I am trying to put two plots on div, one a mesh3d and one a scatter3d.
The function psi is a spherical harmonic Y21 (r, theta, phi) plotted on a a sphere whose radius r (for each x,y,z point) depends on the value of the function Y.

The results are at https://codepen.io/PhilW/pen/ZovmjE.

I have two issues.

The first is that the mesh3d plot on the right does not match the scatter3d on the left. The scatter3d plot correctly show the 4 lobes of the function (spin it to see this better). But the mesh3d plot, for the same data, show a weird box shape. It does show colors in the correct places (red = pos, blue = neg) but the surface generated is not correct. I have tried various values of alphahull, positive values help a little. The docs suggest that it is best to supply i,j,k indices, but I don't know how to easily do this from my x,y,z vertices. Other routines seem to do these sort of plots easily (MathLab) or have specific routines to generate indices (Three). If I force r =1 the mesh3d draws a sphere that has intensity colors at the correct places corresponding to the values of psi. What am I missing?

The second problem is weird. The codepen uses a a newPlot(trace1) followed by an addTraces(trace2). This works fine. But if I changes this to data = [trace1, trace] followed by newPlot(data) the routine crashes displaying a blank 2D graph. You can do this for yourself by changing the // at the end. This seems crazy!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions