ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 11 Jul 2018 11:51:45 -0500graph vertex labellinghttp://ask.sagemath.org/question/42892/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.Tue, 10 Jul 2018 12:11:12 -0500http://ask.sagemath.org/question/42892/graph-vertex-labelling/Answer by slelievre for <p>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 <code>vertex_shape='None'</code> I get a crash deep in matplotlib. If I try anything else I get the marker symbol printed over the label. For example </p>
<pre><code> P = RootSystem(['A',3]).root_poset()
P.show(vertex_color='white')
</code></pre>
<p>Will show the graph with circles over the labels. If I shrink the labels, then the edges cover the labels.
If I do</p>
<pre><code> P = RootSystem(['A',3]).root_poset()
P.show(vertex_color='white', vertex_shape='None')
</code></pre>
<p>there is a strange crash.</p>
http://ask.sagemath.org/question/42892/graph-vertex-labelling/?answer=42906#post-id-42906Trying the various marker shapes described in the
- [matplotlib documentation page for marker shapes](https://matplotlib.org/api/markers_api.html?highlight=shape)
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'`.Wed, 11 Jul 2018 02:36:01 -0500http://ask.sagemath.org/question/42892/graph-vertex-labelling/?answer=42906#post-id-42906Comment by deinst for <p>Trying the various marker shapes described in the</p>
<ul>
<li><a href="https://matplotlib.org/api/markers_api.html?highlight=shape">matplotlib documentation page for marker shapes</a></li>
</ul>
<p>it seems that <code>vertex_shape='_'</code> and <code>vertex_shape='|'</code> work well:</p>
<pre><code>sage: P.show(vertex_color='white', vertex_shape='_')
sage: P.show(vertex_color='white', vertex_shape='|')
</code></pre>
<p>in that (for me at least) they result in what could be expected from <code>vertex_shape='None'</code>.</p>
http://ask.sagemath.org/question/42892/graph-vertex-labelling/?comment=42928#post-id-42928Thanks. I had looked at the matplotlib page, but had not expected that '_' or '|' would do what I wanted.Wed, 11 Jul 2018 11:51:45 -0500http://ask.sagemath.org/question/42892/graph-vertex-labelling/?comment=42928#post-id-42928Answer by FrédéricC for <p>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 <code>vertex_shape='None'</code> I get a crash deep in matplotlib. If I try anything else I get the marker symbol printed over the label. For example </p>
<pre><code> P = RootSystem(['A',3]).root_poset()
P.show(vertex_color='white')
</code></pre>
<p>Will show the graph with circles over the labels. If I shrink the labels, then the edges cover the labels.
If I do</p>
<pre><code> P = RootSystem(['A',3]).root_poset()
P.show(vertex_color='white', vertex_shape='None')
</code></pre>
<p>there is a strange crash.</p>
http://ask.sagemath.org/question/42892/graph-vertex-labelling/?answer=42904#post-id-42904Did you try "view(P)" for the latex display ? This may require installing graphviz and dot2tex.Wed, 11 Jul 2018 02:28:24 -0500http://ask.sagemath.org/question/42892/graph-vertex-labelling/?answer=42904#post-id-42904Comment by slelievre for <p>Did you try "view(P)" for the latex display ? This may require installing graphviz and dot2tex.</p>
http://ask.sagemath.org/question/42892/graph-vertex-labelling/?comment=42912#post-id-42912For 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.Wed, 11 Jul 2018 04:54:58 -0500http://ask.sagemath.org/question/42892/graph-vertex-labelling/?comment=42912#post-id-42912