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.Sun, 24 Feb 2013 09:03:19 +0100Simple tree diagramhttps://ask.sagemath.org/question/9840/simple-tree-diagram/How can I plot a simple tree diagram like the first one of the following link?
http://reference.wolfram.com/mathematica/tutorial/TreeDrawing.html
Is it possible to choose the orientation (from left to right) and display edge labels?
Thank you.
Sat, 23 Feb 2013 21:42:22 +0100https://ask.sagemath.org/question/9840/simple-tree-diagram/Answer by fidbc for <p>How can I plot a simple tree diagram like the first one of the following link? </p>
<p><a href="http://reference.wolfram.com/mathematica/tutorial/TreeDrawing.html">http://reference.wolfram.com/mathemat...</a></p>
<p>Is it possible to choose the orientation (from left to right) and display edge labels?</p>
<p>Thank you.</p>
https://ask.sagemath.org/question/9840/simple-tree-diagram/?answer=14588#post-id-14588You can try
T=Graph()
T.add_edges([[1,2],[2,4],[3,6],[4,8],[5,10],[6,12],[1,3],[2,5],[3,7],[4,9],[5,11],[6,13]]);
T.show(layout='tree',tree_root=1,tree_orientation='down')
The manual does not specify anything about left to right orientation so it might not be currently implemented. Edge labels are disabled by default and you can enable them with the argument `edge_labels=True`. You can check the [manual](http://www.sagemath.org/doc/reference/sage/graphs/graph_plot.html) for further details.Sat, 23 Feb 2013 23:46:13 +0100https://ask.sagemath.org/question/9840/simple-tree-diagram/?answer=14588#post-id-14588Comment by Kaiserfilk for <p>You can try</p>
<pre><code>T=Graph()
T.add_edges([[1,2],[2,4],[3,6],[4,8],[5,10],[6,12],[1,3],[2,5],[3,7],[4,9],[5,11],[6,13]]);
T.show(layout='tree',tree_root=1,tree_orientation='down')
</code></pre>
<p>The manual does not specify anything about left to right orientation so it might not be currently implemented. Edge labels are disabled by default and you can enable them with the argument <code>edge_labels=True</code>. You can check the <a href="http://www.sagemath.org/doc/reference/sage/graphs/graph_plot.html">manual</a> for further details.</p>
https://ask.sagemath.org/question/9840/simple-tree-diagram/?comment=18177#post-id-18177I added edge_labels=True and labels are displayed. I need to display some fractions but they are very small and I'd like to have them larger.Sun, 24 Feb 2013 04:32:36 +0100https://ask.sagemath.org/question/9840/simple-tree-diagram/?comment=18177#post-id-18177Comment by fidbc for <p>You can try</p>
<pre><code>T=Graph()
T.add_edges([[1,2],[2,4],[3,6],[4,8],[5,10],[6,12],[1,3],[2,5],[3,7],[4,9],[5,11],[6,13]]);
T.show(layout='tree',tree_root=1,tree_orientation='down')
</code></pre>
<p>The manual does not specify anything about left to right orientation so it might not be currently implemented. Edge labels are disabled by default and you can enable them with the argument <code>edge_labels=True</code>. You can check the <a href="http://www.sagemath.org/doc/reference/sage/graphs/graph_plot.html">manual</a> for further details.</p>
https://ask.sagemath.org/question/9840/simple-tree-diagram/?comment=18175#post-id-18175If this answered your question, please mark it as accepted.
Regarding the second question, this has been asked previously [here](http://ask.sagemath.org/question/664/font-size-for-edge-label).Sun, 24 Feb 2013 09:03:19 +0100https://ask.sagemath.org/question/9840/simple-tree-diagram/?comment=18175#post-id-18175Comment by Kaiserfilk for <p>You can try</p>
<pre><code>T=Graph()
T.add_edges([[1,2],[2,4],[3,6],[4,8],[5,10],[6,12],[1,3],[2,5],[3,7],[4,9],[5,11],[6,13]]);
T.show(layout='tree',tree_root=1,tree_orientation='down')
</code></pre>
<p>The manual does not specify anything about left to right orientation so it might not be currently implemented. Edge labels are disabled by default and you can enable them with the argument <code>edge_labels=True</code>. You can check the <a href="http://www.sagemath.org/doc/reference/sage/graphs/graph_plot.html">manual</a> for further details.</p>
https://ask.sagemath.org/question/9840/simple-tree-diagram/?comment=18178#post-id-18178Thank you. That's exactly what I wanted to do. Now, I'm trying to add labels but it seems that the \displaystyle command doesn't work.Sun, 24 Feb 2013 04:10:06 +0100https://ask.sagemath.org/question/9840/simple-tree-diagram/?comment=18178#post-id-18178