Ask Your Question

Revision history [back]

Sage can only plot the 1-skeleton right now, and it does this by using the graph theory component of Sage. So if you wanted to fill in the 2-cells, you would need to access the coordinates of the vertices in the plot of the graph and then plot the corresponding triangles. I think this is the way to proceed:

T = simplicial_complexes.Torus() # for example
G = T.graph()
P = G.plot(save_pos=True)
G.get_pos()  # this will return the positions of the vertices

Unfortunately the vertices are forced to be in two dimensions, and I don't see an option like save_pos for G.plot3d(). So it may be hard to get meaningful shading on the triangles.

It's a good question, and we would welcome any contributions in this direction.

Sage can only plot the 1-skeleton right now, and it does this by using the graph theory component of Sage. So if you wanted to fill in the 2-cells, you would need to access the coordinates of the vertices in the plot of the graph and then plot the corresponding triangles. I think this is the way to proceed:

T = simplicial_complexes.Torus() # for example
G = T.graph()
P = G.plot(save_pos=True)
G.get_pos()  # this will return the positions of the vertices

Unfortunately the vertices are forced to be in two dimensions, and I don't see an option like save_pos for G.plot3d(). So it may be hard to get meaningful shading on the triangles.

Another option (which would be more work but might be better in the long run) would be to implement a save_pos option for G.plot3d() and then use that for plotting the triangles.