-1

I am using Maxima and I have a lot of resulting plots that I want to save on drive for other uses (making GIF...etc)

This is what I am looking at:

Is there any code that can autosave the plots instead of having to save it manually one by one?

Thank you in advance.

Thomas Hirsch
  • 2,102
  • 3
  • 19
  • 39

1 Answers1

1

Well, one approach is to specify a file name in the arguments of plot2d. Then the plot is output directly to the file and it doesn't show up in the GUI. E.g.,

plot2d (sin(x), [x, 0, 10], [png_file, "mysinplot.png"]);

plot2d recognizes png_file, pdf_file, ps_file and svg_file. In each case, ? png_file, etc, will show some info about that.

Note that there isn't any file output flag for GIF output. The closest thing is PNG which is similar to GIF.

I think draw also recognizes different file formats but I don't know about that without searching the documentation.

If you are generating a lot of plots, it might be convenient to automatically generate file names via sconcat, e.g. sconcat("myplot", i, ".png") produces "myplot10.png" when i is equal to 10.

Robert Dodier
  • 16,905
  • 2
  • 31
  • 48
  • Thank you for your answering, I know this way but its for example for an equation with one or two variables but in my case there are a lot of (for and if) loops thats related to each other so my question is if there's any way to save the output plot directly to a directory folder location? Sincerely – Mohammad Fawaier Mar 12 '19 at 20:48
  • `plot2d` writes files into the folder named by `maxima_tempdir`. So you can set `maxima_tempdir` to some suitable folder name and outputs from `png_file`, etc., will go there. If you are working on MS Windows, I don't know whether you need to write "/" in the folder name, or "\". Try it both ways and see what works. If you try "/", probably you have to write "\\" in order to get a single "\" in the folder name. – Robert Dodier Mar 12 '19 at 22:01
  • I think its "/" for example what I made is maxima_tempdir: "C:/Users/DELL/Desktop/Animation"; but its not useful until now, what I get as a result is one pdf file that is not opening and one or two plots out of several that shown for a moment and disappeared finally! – Mohammad Fawaier Mar 13 '19 at 00:02