# How to save a plot from notebook?

Is it possible to export a plot, preferable in a vector format from a notebook?

How to save a plot from notebook?

Is it possible to export a plot, preferable in a vector format from a notebook?

add a comment

10

If `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.

0

a = [(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.

Asked: **
2010-08-21 11:56:18 -0500
**

Seen: **2,198 times**

Last updated: **Aug 21 '10**

Change the edge thickness in a graph plot

plot issue with a self-defined piecewise function

combine sage plot with matplotlib

Can I scatter plot shaded grids?

Can I add mathematical formulas to a plot?

multiple region_plots in one plot

GUI backend MATPLOTLIB in Sage

How do I plot a real function whose computation involves complex intermediate results?

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.