ob-sagemath
ob-sagemath copied to clipboard
error when generating sage pdf files
Thanks for the sage integration with org-babel. It works well for text, code, and tables output, but not for some graphics output types. More specifically I am not able to specify pdf or eps as file output types. I need at least one vector format, even svg would be fine. Alas but to no avail.
Your png example works well. But change that same src block png to pdf or eps, the output generated is not valid postscript file. (see attached pdf for an sample file generated by sage). Is this something that can be fixed with ob-sagemath or a problem with org-babel?
A related question: how can I use the src_block vars inside sage code in that block? For example, :file below?
Try this src_block in any org file to recreate the problem PDF file:
#+begin_src sage :file image.pdf
g=Graph({1:[2,3], 2:[1,3], 3:[1,2]});g
#+end_src
I paste the code of your block in SAGE, and the result is not a plot. Are you sure the code reflects what you want?
In SAGE I tried
g=Graph({1:[2,3], 2:[1,3], 3:[1,2]});
g.plot().save('/tmp/foo.pdf')
That could be a starting point.
Doxdrum, yes you are right about running in SAGE and your example works. However, I'm running from a source block inside an ORG file in Emacs. ob-sagemath dumps only to png and not other formats.
As of 9.7.beta8, this works :
#+name: test2
#+begin_src sage :exports both :results file link :file test2.pdf
plot(sin, (-pi, pi), figsize=4)
#+end_src
#+RESULTS: test2
[[file:test2.pdf]]
I sugest closing this issue...
Any chance something similiar could be done but for svg as well?