Anthony Lozano
Anthony Lozano

Reputation: 621

How can I plot a 3d graph in python with igraph?

I am trying to create a 3d graph using igraph with Python on Windows 7. I have installed Cairo and can plot 2d graphs just fine, but when I try to use any 3d layout I get

TypeError: bounding boxes work for 2D layouts only

This is my code so far:

graph = Graph.Lattice([11,6], circular=False) #The graph is only circular along one "edge" of the lattice
graph.add_edges(zip(range(0,66,11), range(10,66,11)))
visual_style = { 
            "layout": graph.layout("sphere",)
            }
plot(graph, **visual_style)

Upvotes: 3

Views: 2521

Answers (1)

Tamás
Tamás

Reputation: 48051

3D plotting is not supported at all in the Python interface of igraph - it can only calculate the coordinates for you, but you have to feed those coordinates to an external 3D visualizer.

Upvotes: 3

Related Questions