Ask Your Question
6

How to save a plot from notebook?

asked 2010-08-21 18:56:18 +0100

entity gravatar image

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

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
10

answered 2010-08-21 19:49:57 +0100

Mike Hansen gravatar image

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.

edit flag offensive delete link more

Comments

Thats easy and works, thank you!

entity gravatar imageentity ( 2010-08-22 06:50:06 +0100 )edit
0

answered 2010-08-21 19:29:35 +0100

ccanonc gravatar image

updated 2010-08-21 19:30:24 +0100

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.

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: 2010-08-21 18:56:18 +0100

Seen: 2,754 times

Last updated: Aug 21 '10