Ask Your Question
0

Graph theory exporting problems

asked 2013-09-19 20:20:10 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I type in the following SAGE code and get the graph on the screen that I would expect to get.

g = Graph({0,[1,2,2]}); g

g.plot(graph_border = True)

When I try to export this to a file with the following code I get an "AssertionError" message.

g = Graph({0,[1,2,2]}); g

g.plot(graph_border = True).save('graph.pdf')

How can I fix this so that I can output this graph as a pdf file. I love how easy I can make nice looking graphs in SAGE, but it is useless if I can't export them to use in Latex.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-09-20 11:18:11 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Thanks for the reply John. I tried outputting it as a png file and I don't get the error message anymore. But, when I evaluate the two lines of code I get the graph without a link to the file. Where do I find the file?

It is strange I was watching Will Stein's graph theory tutorial and typing exactly as he did and it didn't work for me on my computer. When he typed the code I suggested in the original question he got a link to a pdf file, which he could click on and then have access to the file.

edit flag offensive delete link more
0

answered 2013-09-20 02:06:40 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Save it as a png file instead of a PDF file. What should work is

g.plot(graph_border = True).save('graph.png')

Then your LaTeX file should look like

\documentclass{article}
\usepackage{graphicx}
\begin{document}

Hello.

\includegraphics{graph.png}

Goodbye.

\end{document}

For this particular graph, I get a nicer picture doing g.plot(graph_border = True) than doing g.plot(graph_border = True).save('graph.png'), so I would actually do the first command to view the picture, and then save that picture manually into graph.png.

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

Stats

Asked: 2013-09-19 20:20:10 +0200

Seen: 1,011 times

Last updated: Sep 20 '13