Ask Your Question

graph vertex labelling

asked 2018-07-10 12:11:12 -0500

deinst gravatar image

updated 2018-07-10 13:41:45 -0500

I have a graph (poset actually) that has a rational function labelling each vertex. I would like to show just the edges and the vertex labels. If I try to set vertex_shape='None' I get a crash deep in matplotlib. If I try anything else I get the marker symbol printed over the label. For example

  P = RootSystem(['A',3]).root_poset()'white')

Will show the graph with circles over the labels. If I shrink the labels, then the edges cover the labels. If I do

  P = RootSystem(['A',3]).root_poset()'white', vertex_shape='None')

there is a strange crash.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2018-07-11 02:36:01 -0500

slelievre gravatar image

Trying the various marker shapes described in the

it seems that vertex_shape='_' and vertex_shape='|' work well:

sage:'white', vertex_shape='_')
sage:'white', vertex_shape='|')

in that (for me at least) they result in what could be expected from vertex_shape='None'.

edit flag offensive delete link more


Thanks. I had looked at the matplotlib page, but had not expected that '_' or '|' would do what I wanted.

deinst gravatar imagedeinst ( 2018-07-11 11:51:45 -0500 )edit

answered 2018-07-11 02:28:24 -0500

FrédéricC gravatar image

Did you try "view(P)" for the latex display ? This may require installing graphviz and dot2tex.

edit flag offensive delete link more


For me, without graphviz or dot2tex,

sage: is_package_installed('graphviz')
sage: is_package_installed('dot2tex')

the following worked,

sage: P = RootSystem(['A',3]).root_poset()
sage: view(P)

resulting in a nice view with the "alpha" letters typeset in LaTeX.

The layout was not the one you would expect for a poset though.

slelievre gravatar imageslelievre ( 2018-07-11 04:54:58 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-07-10 12:11:12 -0500

Seen: 30 times

Last updated: Jul 11