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, 22 Aug 2010 06:50:06 +0200How to save a plot from notebook?https://ask.sagemath.org/question/7608/how-to-save-a-plot-from-notebook/Is it possible to export a plot, preferable in a vector format from a notebook?Sat, 21 Aug 2010 18:56:18 +0200https://ask.sagemath.org/question/7608/how-to-save-a-plot-from-notebook/Answer by Mike Hansen for <p>Is it possible to export a plot, preferable in a vector format from a notebook?</p>
https://ask.sagemath.org/question/7608/how-to-save-a-plot-from-notebook/?answer=11505#post-id-11505If `p` is any plot object, then you can use the `save` method to save it to a file. The type of file written will be based on the extension of filename given. For example,
p = plot(x^2, -5, 5)
p.save('filename.svg')
will save an SVG. Since the directory in which to save the image was not specified, it will do it in a special directory reserved for the input cell. The notebook will automatically detect that this file is present and then either display it or display a link from which you can download it. You can also use `.eps` or `.ps` for PostScript files which are also vector graphics.
Sat, 21 Aug 2010 19:49:57 +0200https://ask.sagemath.org/question/7608/how-to-save-a-plot-from-notebook/?answer=11505#post-id-11505Comment by entity for <p>If <code>p</code> is any plot object, then you can use the <code>save</code> method to save it to a file. The type of file written will be based on the extension of filename given. For example,</p>
<pre><code>p = plot(x^2, -5, 5)
p.save('filename.svg')
</code></pre>
<p>will save an SVG. Since the directory in which to save the image was not specified, it will do it in a special directory reserved for the input cell. The notebook will automatically detect that this file is present and then either display it or display a link from which you can download it. You can also use <code>.eps</code> or <code>.ps</code> for PostScript files which are also vector graphics.</p>
https://ask.sagemath.org/question/7608/how-to-save-a-plot-from-notebook/?comment=22937#post-id-22937Thats easy and works, thank you!Sun, 22 Aug 2010 06:50:06 +0200https://ask.sagemath.org/question/7608/how-to-save-a-plot-from-notebook/?comment=22937#post-id-22937Answer by ccanonc for <p>Is it possible to export a plot, preferable in a vector format from a notebook?</p>
https://ask.sagemath.org/question/7608/how-to-save-a-plot-from-notebook/?answer=11484#post-id-11484a = [(x,x^2) for x in xrange(100)];
img = list_plot(a);
img.save("filename.svg");
I'm sure there are more elegant idioms and display options, but that will indeed save a scalable vector graphic.Sat, 21 Aug 2010 19:29:35 +0200https://ask.sagemath.org/question/7608/how-to-save-a-plot-from-notebook/?answer=11484#post-id-11484