Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I made a table of ten plots:

Table[Plot[u[t, x] /. wws, {x, -10, 10}], {t, 0, 10, 1}]

I want to save them all to my file system. I know, that I can save each plot separataly by "Save as...", but it's tedious. Can anybody offer anything that will automate this (because in future it will be 50 plots)?

share|improve this question

marked as duplicate by Öskå, m_goldberg, ubpdqn, Michael E2, Yves Klett Jul 1 '14 at 14:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

plots = Table[Plot[x, {x, -10, 10}], {t, 0, 10, 1}];
names = ToString@StringForm["~/Plot``.pdf", #] & /@ ToString /@ Range@Length@plots;
Export[#1, #2] & @@@ Thread@{names, plots}

Giving ten different plots exported in PDF.

share|improve this answer
doh, you type faster. – bobthechemist Jul 1 '14 at 12:17
@bobthechemist Well.., I also looked for duplicates.. :) – Öskå Jul 1 '14 at 12:18

One way to do this is to Map and Export routine:

plots = Table[Plot[Sin[a x], {x, 0, 4 Pi}], {a, 1, 10}]
MapIndexed[Export[ToString[First@#2] <> ".png", #1] &, plots]

This stores the files with names 1.png, 2.png, etc.

share|improve this answer

Just for variety and to deal with ordering issues that some times arise with 1,10,2 by padding left with zeros. This assumes that plots contains list of graphics objects:

 Export["plot" <> #1 <> ".pdf", #2] &, {IntegerString[#, 10, 3] & /@ 
   Range[Length@plots], plots}]

File will be "plot001.pdf","plot002.pdf",etc

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.