Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to use the Export command to convert a list of plots into a *.gif file, and the command runs and executes well, but I can't find the file! Where is it supposed to go? Did it even work?

Here is my code :

  q[n_, x_] := x (1 + x)^n + x^n;
  points = Table[
     Map[{Re[#], Im[#]} &, 
   Flatten[NSolve[q[n, x] == 0, x][[All]] /. Rule -> (#2 &)]], {n, 1, 20}];

  Export["domniationrootsstargraph.gif", 
    Table[ListPlot[points[[i]], PlotRange -> {{-15, 4}, {-10, 10}}], {i, 1, 20, 1}]
        ]

Thanks in advance =)

share|improve this question
1  
You can specify the full path. Windows example: Export["c:\\a.gif", img] –  belisarius Jul 21 '12 at 22:27
1  
I added a few more tricks in the answer, I hope it helps too ;-) –  Vitaliy Kaurov Jul 21 '12 at 22:44
add comment

4 Answers 4

up vote 18 down vote accepted

Easy to check:

Directory[]

Which in my case on Win7 gives:

"C:\Users\vitaliyk\Documents"

You can always specify a complete path to a destination you'd like to save with, for example, top menu Insert >> FilePath which will bring a standard browse-directory window:

enter image description here

This would go instead of your "domniationrootsstargraph.gif". A useful trick to know is command

SetDirectory[NotebookDirectory[]]

which will allow saving your files by default (without full-path specification) into the directory where your notebook is saved. Also to check files in the CurrentDirectory use

FileNames[]

or, for example,

FileNames["*.gif"]

for specific file types.

share|improve this answer
    
Thank you! Exactly what I wanted. –  Patrick Da Silva Jul 21 '12 at 22:27
add comment

Just to add a slightly different method; something I like to do, since I am fairly OCD about always working in a notebook which is already saved in some directory, is to use NotebookDirectory:

Export[NotebookDirectory[]<>"test.gif",list]

This saves your file in the same directory as your .nb file, and is fairly easy to remember in a pinch.

share|improve this answer
    
This only works if the Notebook has first been saved. +1 nevertheless –  Mr.Wizard Nov 9 '12 at 8:47
add comment

You might try

Export[SystemDialogInput["FileSave", "domniationrootsstargraph.gif"], 
   Table[ListPlot[points[[i]], PlotRange -> {{-15, 4}, {-10, 10}}], {i, 1, 20, 1}]]

This will let you pick the directory interactively.

share|improve this answer
add comment

Try this, one I compiled for my thesis writing:

Export2PDF[PlotName_] := 
Module[{A = 600}, 
Export[SystemDialogInput["FileSave", 
StringJoin[{ToString[FileName], ".pdf"}]], PlotName, 
"AllowRasterization" -> True, ImageSize -> 360, 
ImageResolution -> A]]

Plot example:

Plot1 = Plot3D[
Sin[x] Sin[y], {x, -\[Pi], \[Pi]}, {y, -2 \[Pi], 2 \[Pi]}]

Output:

1

Export Code:

Export2PDF[Plot1]

Dialog Box: 2

SAVE and DONE !

3

share|improve this answer
    
You can also right-click the figure and choose Save As... I won't give you quite as much control over the options though. –  Szabolcs May 12 '13 at 18:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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