Ask Your Question
0

SageTex and graphs

asked 2013-08-27 12:27:20 +0200

Holosmos gravatar image

Hey guys, Today i was looking for some graph plotting and i didn't arrived to use that piece of code in my .tex :

from sage.graphs.graph_coloring import edge_coloring
g = graphs.CompleteGraph(10)
g.graphplot(edge_colors=edge_coloring(g, hex_colors=True)).plot()

I can insert the first part in a block, but to plot I don't have the answer. I tried : \sageplot{g.graphplot(edge_colors=edge_coloring(g, hex_colors=True)).plot()} and \sage{g.graphplot(edge_colors=edge_coloring(g, hex_colors=True))} but nothing works :/

Of course \sage{g} works but i'd like to have the graphical options !

Help plz :)

Ty

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-08-28 09:59:26 +0200

Luca gravatar image

This seems to be a bug in pdf exports. It has been reported as ticket http://trac.sagemath.org/ticket/15116.

As a temporary fix, you can

\begin{sageblock}
  from sage.graphs.graph_coloring import edge_coloring
  g = graphs.CompleteGraph(10)  
  p = g.graphplot(edge_colors=edge_coloring(g, hex_colors=True)).plot()
  p.save('graph.eps')
\end{sageblock}

\includegraphics{graph.eps}

Note that LaTeX will complain it cannot find graph.eps on first compilation, just ignore the error.

edit flag offensive delete link more
0

answered 2013-08-28 10:52:38 +0200

Holosmos gravatar image

It works Thank you !

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-08-27 12:27:20 +0200

Seen: 615 times

Last updated: Aug 28 '13