ipyvolume icon indicating copy to clipboard operation
ipyvolume copied to clipboard

[question] New 'graph' plot type

Open chrisgee opened this issue 3 years ago • 4 comments

Hi,

I would like to implement a new plot type in ipyvolume that is intended to display graphs. In particular I would like to have nodes of that graph to have 3d locations and individual properies (color,shape, etc) and edges connecting any pair of nodes of that graph too (visible, color, line properties)

I have trouble identifying where to start. Any help is appreciated.

If I am successful and there is interest, I am happy to contribute.

Cheers, Christoph

chrisgee avatar Jul 29 '21 13:07 chrisgee

Hi,

sorry for the late reply. Could you elaborate what you mean, and isn't this already possible with scatter, and the connected attribute (that draws lines between the points).

Cheers,

Maarten

maartenbreddels avatar Oct 29 '21 18:10 maartenbreddels

Dear Maarten,

yes scatter would be connecting successive pairs of points in a list of those (or do I get that wrong?).

I would like to show arbitrary graphs (i.e. points (nodes in graph theory) with arbitrary connections (edges) between those).

In particular, I would have a set of points (potentially with different vis options like color/marker shape etc) and would like to have connections between some of these. I.e. the data would be

[list of points], [list of point properties], [list of connections, point i is connected to point j], [connection visualization properties]

Each of these lists may have a second dimension for animation.

I have been moving to a different solution now (based on bokeh) which is not embedding the whole animation in the HTML but updating from python. But I would be interested in what needs to be done in case I would like to come back to ipyvolume.

Cheers, Christoph

chrisgee avatar Nov 01 '21 10:11 chrisgee

Hi Christoph,

You are right about scatter, but Mesh also has an option to draw lines between two points (using indices), you can check out the implementation of pylab.plot_mesh, which calls _make_triangles_lines. I think using a scatter and a mesh, and by giving them then same x, y, and z values, you should be able to make what you want.

cheers,

Maarten

maartenbreddels avatar Nov 01 '21 10:11 maartenbreddels

Dear Maarten,

thanks for the hint. This is heading in the right direction. I will have to check if it does what I need (number of lines will be changeing in my animations and hence the array are not rectangular).

None the less I will take a look.

Cheers, Christoph

chrisgee avatar Nov 01 '21 10:11 chrisgee