# graph vertex labelling

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()
P.show(vertex_color='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()
P.show(vertex_color='white', vertex_shape='None')


there is a strange crash.

edit retag close merge delete

Sort by » oldest newest most voted

Trying the various marker shapes described in the

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

sage: P.show(vertex_color='white', vertex_shape='_')
sage: P.show(vertex_color='white', vertex_shape='|')


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

more

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

( 2018-07-11 11:51:45 -0500 )edit

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

more

For me, without graphviz or dot2tex,

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


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.

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