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.Mon, 18 Jan 2016 12:21:09 +0100Change the edge thickness in a graph plothttps://ask.sagemath.org/question/32251/change-the-edge-thickness-in-a-graph-plot/I want to plot a graph with many edges, but they just end up looking like a black mass. I can see how to change vertex size and whatnot but not edge thickness.
sage: H=graphs.CompleteGraph(100)
sage: H.show()
Launched png viewer for Graphics object consisting of 5051 graphics primitives
Not sure where my karma went, but you can guess what this looks like.Sun, 17 Jan 2016 14:23:52 +0100https://ask.sagemath.org/question/32251/change-the-edge-thickness-in-a-graph-plot/Answer by lutherdriggers for <p>I want to plot a graph with many edges, but they just end up looking like a black mass. I can see how to change vertex size and whatnot but not edge thickness.</p>
<pre><code>sage: H=graphs.CompleteGraph(100)
sage: H.show()
Launched png viewer for Graphics object consisting of 5051 graphics primitives
</code></pre>
<p>Not sure where my karma went, but you can guess what this looks like.</p>
https://ask.sagemath.org/question/32251/change-the-edge-thickness-in-a-graph-plot/?answer=32276#post-id-32276 I figured it out. The answer is **do not use `GraphPlot`. Use `GraphLatex`**. GraphLatex makes fairly nice 2D plots as `tikzpicture` with latex formatting on labels and lots of great customisations options. I would put a link to the docs but for some reason I don't have any Karma yet and cannot. For large, dense graphs it can be hard to view the whole thing on the default settings that view(H) gives you. In that case export the latex to a file and compile it in a minimal document with `resizebox`, e.g., as follows:
sage code:
H=graphs.CompleteGraph(100)
H.set_latex_options(
graphic_size=(200,200), #large value helps for large dense graphs
vertex_size=1,
edge_thickness=0.05,)
#view(H) #just display the latex graph in sage or in pdf viewer
with open('graph_tmp.tex','w') as f:
f.write(latex(H))
latex document:
\documentclass{article}
\usepackage{tkz-graph}
\usepackage{savetrees}
\begin{document}
\resizebox{.9\textwidth}{.9\textwidth}{
\input{graph_tmp}
}
\end{document}Mon, 18 Jan 2016 12:21:09 +0100https://ask.sagemath.org/question/32251/change-the-edge-thickness-in-a-graph-plot/?answer=32276#post-id-32276