#1480 Working directory for plot output is not defined



Using WXMaxima on Windows XP the working directory for gnuplot file output is badly defined or undefined.

> plot2d (sin(x), [x, -5, 5],

Does write its output to somewhere or even to nowhere. At least I could not find it. The documentation gives no information about this.

One could assume that this file is written to the directory where the maxima-file resides or otherwise to the users temp-directory.


The following command does write the file to the expected location, but it is very unconvenient to specify an absolute path:
> plot2d (sin(x), [x, -5, 5],

Proposed Improvement

Make path names for plot output relative to the documents path. This would allow to specify files as follows:


Software used

Maxima version: 5.15.0
Maxima build date: 17:36 4/20/2008
host type: i686-pc-mingw32
lisp-implementation-type: GNU Common Lisp (GCL)
lisp-implementation-version: GCL 2.6.8


  • Dieter Kaiser

    Dieter Kaiser - 2010-09-05

    When a filename is passed to functions like PLOT2D, SAVE, or WRITEFILE and the filename is not a complete pathname, Maxima stores the file in the current working directory. The current working directory depends on the system like Windows or Linux and on the installation.

    When I start a Maxima console from an installed icon which starts maxima.bat, the current working directory on my system is 'c:/Dokumente und Einstellungen/Dieter/'. This is a default choice for a current working directory on Windows. When I start wxMaxima the current working directory is 'd:/Programme/Maxima-5.22.1/wxMaxima/'. This is the path I have installed Maxima 5.22. The current working directory can be configured in the property menu of the icon, which starts the program.

    On a Linux system I always start at first a terminal, change to a suitable directory and then I start Maxima from the terminal. The last directory becomes the current working directory.

    Here are some examples to get these informations. At first the plot of the example:

    (%i1) plot2d(sin(x),[x,-5,5],[gnuplot_term,ps],[gnuplot_out_file,'mytest.ps']);

    The Maxima function FILE_SEARCH can locate the file. But it does not return a full pathame. This indicates that the file is stored in the current working directory, otherwise FILE_SEARCH will return a full pathname:

    (%i2) file_search('mytest.ps');
    (%o2) mytest.ps

    We can use the Lisp function TRUENAME to get in addition the full pathname.

    (%i3) ?truename(file_search('test.ps'));
    (%o3) /home/dieter/workspace/maxima/test.ps

    The file is stored in the current working directory '/home/dieter/workspace/', that is the directory I have started Maxima on my Linux system. We can extract the directory the following way:

    (%i4) pathname_directory(?truename(file_search('test.ps')));
    (%o4) /home/dieter/workspace/maxima/

    We have an undocumented function DIRECTORY which shows the current working directory on a Linux system when called with an empty string. On a Windows system with GCL the function shows a list of files and directories of the current working directory:

    (%i5) directory('');
    (%o5) [/home/dieter/workspace/maxima/]

    We have two global Lisp variables *maxima-tempdir* and *maxima-userdir*. When we do not pass a filename to the function PLOT2D, the output of gnuplot is stored in the directroy named by *maxima-tempdir*.

    I would tend to say that the current behavior to store files in the current working directory might be not what a user expects, but this behavior is not a bug.

    We might improve the documentation on this point. Another point might be to improve FILE_SEARCH and other file input/output functions to return always a full pathname.

    Further remarks:

    Because, the undocumented function DIRECTORY behaves different on Linux and Windows I hesitated to document it. Perhaps, we should do an implementation which is more independent from the underlying system and Lisp or cut it out.

    Furthermore, we have the function LOAD_SEARCH_DIR. This function prints the value of the global Lisp variable *default-pathname-defaults*. On SBCL this global Lisp variable is set to the current working directory, but not on other Lisp's like CLISP and GCL. On the latter Lisp's the variable *default-pathname-defaults* is NIL. I think this function should be cut out too.

    Dieter Kaiser

  • Dieter Kaiser

    Dieter Kaiser - 2010-09-05

    A comment has been added in Input.texi revision 1.79 about the behavior of Maxima to use the current working directory to store a file. It might be a feature request to change the current behavior of Maxima.

    Setting the status to pending and the resolution to "works for me".
    Dieter Kaiser

  • Dieter Kaiser

    Dieter Kaiser - 2010-09-05
    • status: open --> pending
  • SourceForge Robot

    • status: pending --> closed
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).


Log in to post a comment.