jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
951 stars 188 forks source link

support for Points? #60

Closed paul-shannon closed 7 years ago

paul-shannon commented 8 years ago

After working through Examples.ipynb (very fine work, by the way) I am trying to create a bare bones 3d scatter plot. This javascript (adapted from here) when loaded in a simple html file works fine, but the THREE.Points class does not seem to be represented yet in pythreejs:

var pointGeometry = new THREE.Geometry();
for (var i=0; i<pointCount; i++) {
    var x = Math.random() * 100 - 50;
    var y = x*0.8+Math.random() * 20 - 10;
    var z = x*0.7+Math.random() * 30 - 15;
    pointGeometry.vertices.push(new THREE.Vector3(x,y,z));;
    pointGeometry.colors.push(new THREE.Color("red"));
    } // for i

var points = new THREE.Points(pointGeometry, mat);
scatterPlot.add(points);
scene.add(scatterPlot);
renderer.render(scene, camera);

Is support for the Points class coming? Or perhaps you suggest an alternative approach? Thanks for this excellent widget.

richardagalvez commented 8 years ago

Hi Paul,

I'm trying to do the same and have been able to make multiple spheres with small radii. Hope that ties you over until we figure out a scatter plot!

paul-shannon commented 7 years ago

terrific! thank you. I will make time to try this out next week.

richardagalvez commented 7 years ago

I see you just read this; small update, I switched over to plotly (offline mode works best) and it's working out very well for 3d scatter plots. Best of luck--

paul-shannon commented 7 years ago

Thanks, Richard. May I ask a few questions?

How many points have you been able to render, and interact with? We hope to visualize ~1M without much interactive latency.

Does plotly run well within a notebook, as a jupyter widget?

Thanks!

On Nov 10, 2016, at 12:53 PM, Richard Galvez notifications@github.com wrote:

I see you just read this; small update, I switched over to plotly (offline mode works best) and it's working out very well for 3d scatter plots. Best of luck--

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

richardagalvez commented 7 years ago

I find it works exceptionally well-- again, keypoint, offline mode. I will add a notebook example on my github soon; it's just a project currently in preparation so have to remove subject-sensitive information. There are approximate 5k points. I will place link here in a minute.

richardagalvez commented 7 years ago

Here you go--

http://nbviewer.jupyter.org/github/richardagalvez/Exo_list/blob/master/3dplot_plotly.ipynb

Best of luck with it. I find it's worked out pretty well thus far.

Richard

vidartf commented 7 years ago

This should now be fixed via #88. Please reopen if there's anything I missed.

yiakwy commented 5 years ago

@richardagalvez I think that your solution has nothing to do with pythreejs, right?

vidartf commented 5 years ago

His solution is by using another plotting library, so you are correct.

richardagalvez commented 5 years ago

@richardagalvez I think that your solution has nothing to do with pythreejs, right?

That is correct, as mentioned above--- I've since moved on to other libraries for this sort of visualization.