ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 10 Jan 2015 07:29:00 +0100Graph edge label: formatting possibilitieshttps://ask.sagemath.org/question/25448/graph-edge-label-formatting-possibilities/I have a graph with like this and would like to format ( e.g. color ) the edge labels more individual. Is it possible for example to make from 'a|b' the 'a' red and 'b' blue? Also different font types ( bold, italic ) etc would be interesting.
G = Graph(multiedges=True)
G.add_edges( [(0,1,'a|b'),(1,2,'c|d'),(2,3,'e|f'),(3,4,'g|h'),(4,0,'i|j')] )
H = G.plot(edge_labels=True, graph_border=True)
H.show()
When I remember correctly, there is (limited) support for TeX-formatting, could this be used somehow to achieve the formatting?Fri, 09 Jan 2015 13:05:52 +0100https://ask.sagemath.org/question/25448/graph-edge-label-formatting-possibilities/Answer by Nathann for <p>I have a graph with like this and would like to format ( e.g. color ) the edge labels more individual. Is it possible for example to make from 'a|b' the 'a' red and 'b' blue? Also different font types ( bold, italic ) etc would be interesting.</p>
<pre><code>G = Graph(multiedges=True)
G.add_edges( [(0,1,'a|b'),(1,2,'c|d'),(2,3,'e|f'),(3,4,'g|h'),(4,0,'i|j')] )
H = G.plot(edge_labels=True, graph_border=True)
H.show()
</code></pre>
<p>When I remember correctly, there is (limited) support for TeX-formatting, could this be used somehow to achieve the formatting?</p>
https://ask.sagemath.org/question/25448/graph-edge-label-formatting-possibilities/?answer=25450#post-id-25450The part of your question related to colors is answered there: http://ask.sagemath.org/question/25413/graph-colored-edge-labels/ Fri, 09 Jan 2015 13:43:10 +0100https://ask.sagemath.org/question/25448/graph-edge-label-formatting-possibilities/?answer=25450#post-id-25450Comment by Nathann for <p>The part of your question related to colors is answered there: <a href="http://ask.sagemath.org/question/25413/graph-colored-edge-labels/">http://ask.sagemath.org/question/2541...</a> </p>
https://ask.sagemath.org/question/25448/graph-edge-label-formatting-possibilities/?comment=25460#post-id-25460No, it colors the edges, not the text.Sat, 10 Jan 2015 07:29:00 +0100https://ask.sagemath.org/question/25448/graph-edge-label-formatting-possibilities/?comment=25460#post-id-25460Comment by herb for <p>The part of your question related to colors is answered there: <a href="http://ask.sagemath.org/question/25413/graph-colored-edge-labels/">http://ask.sagemath.org/question/2541...</a> </p>
https://ask.sagemath.org/question/25448/graph-edge-label-formatting-possibilities/?comment=25451#post-id-25451But the solution mentioned there does not allow to colorize sub-strings within the label differently, right?Fri, 09 Jan 2015 14:28:16 +0100https://ask.sagemath.org/question/25448/graph-edge-label-formatting-possibilities/?comment=25451#post-id-25451