GnuPlot and Windows Maxima



Hi all.

Sorry about the multiple posts but I never know from one moment to the next
whether I will work further on a project on any given day and I want to
record the results before they are lost forever.

To make gnuplot work with the standard Maxima 5.9.0 distribution on Windows
XP, I did the following:


1. Downloaded GnuPlot version 3.8i binary for Windows.  Version 3.7.3 should
be alright but I haven't tried it and it is less advanced at 3D displays.

   http://www.sci.muni.cz/~mikulik/gnuplot/gp38i-Oct05_2002-winbin.zip


2. Copied "pgnuplot.exe" and "wgnuplot.exe" executables into the Maxima bin
directory - anywhere in your path should be OK.


3. Installed Activestate TCL/TK 8.4.1.  If all is well, the Windows Explorer
should show files with a ".tcl" file extension with the Activestate TCL
icon.  This file association allows TCL scripts to behave as if they were
executable on Windows.  I would expect that associating your current TCL
interpreter with that file extension would work also, but maybe not.  The
TCL bin directory should be in your path now.


4. Copied "tclsh84.exe" and "wish84.exe" exes to "tclsh.exe" and "wish.exe".


5. Copied:

 "c:\Program Files\Maxima-5.9.0\libexec\maxima\5.9.0\mgnuplot"

   to:

 "c:\Program Files\Maxima-5.9.0\libexec\maxima\5.9.0\mgnuplot.tcl"


6. Patched the new "mgnuplot.tcl" version to use the pipe launching GnuPlot
executable and to use generic TCL rather than Unix execs as follows:

============================================
7c6
< set gnuPlotstream [open {|  gnuplot  } r+]
---
> set gnuPlotstream [open {| pgnuplot  } r+]
48c47
<     exec rm -f $tmp
---
>     file delete $tmp
50c49
<     while {[file exists $tmp] <= 0} {exec sleep 0}
---
>     while {[file exists $tmp] <= 0} {after 1000[]}
============================================


7. Put a batch file into the Maxima bin directory called "xmaxima.bat" with
these commands:

============================================
set shell=c:\windows\system32\cmd.exe
c:\Progra~1\Maxima-5.9.0\bin\xmaxima
============================================

THIS STEP IS VERY IMPORTANT!!!  The batch file gets rid of spurious shell
environment variable settings (my system has MKS tools installed which seems
to lengthen process launching times and cause other subtle and nasty
problems).  The script also uses the short form of the path to the maxima
executable when launching it - a path with spaces causes the process launch
to fail to find "mgnuplot.tcl".


8. Modified the desktop icon for Maxima to launch that batch file. I also
used the DOSified short form path.


9. Enjoyed plotting 3D functions from Maxima.  The new GnuPlot allows 3D
rotations with the mouse (which is faster than the TCL script's slider
controls).  You can also cut and paste plot results from GnuPlot into MS
Word documents (but they are just bitmaps).

An example command to test with is:

  plot3d(2^(x^2-y^2),[x,-1,1],[y,-2,2],[plot_format,gnuplot]);

Cheers

Mike Thomas.


| -----Original Message-----
| From: maxima-admin at www
| [mailto:maxima-admin@www.ma.utexas.edu]On Behalf Of Mike Thomas
| Sent: Thursday, March 27, 2003 2:34 PM
| To: Mike Thomas; David.Billinghurst@riotinto.com;
| maxima@www.ma.utexas.edu
| Subject: GnuPlot and Windows Maxima
|
|
| OK, good news (thanks again Dave).
|
| Once I understood that "pgnuplot" needed to launch "wgnuplot" rather than
| being a standalone plotting executable I got GnuPlot 3.8i going
| with the CVS
| version of Maxima on Windows by:
|
| 1. Copying "plotting/mgnuplot" to "plotting/mgnuplot.tcl"
|
| 2. Putting "pgnuplot.exe" and "wgnuplot.exe" in the current directory, and
|
| 3. Patching "plotting/mgnuplot.tcl" as follows:
|
| ==========================================================
| 7c7
| < set gnuPlotstream [open {|  gnuplot  } r+]
| ---
| > set gnuPlotstream [open {| pgnuplot } r+]
|
| ==========================================================
|
| So this Maxima command now launches GnuPlot:
|
| plot3d(x^2-y^2,[x,-2,2],[y,-2,2],[grid,10,10],[plot_format,gnuplot]);
|
| Make sure you don't set the grid size too big.  For example, on a 2.4GHz
| machine, [grid,100,100] was terribly slow.
|
| Even better, you can use the GnuPlot Options menu to copy the plot picture
| to the clipboard, and then paste the picture directly into Word 2000!!!
|
| Strangely enough I haven't flown from XMaxima with the release version
|  yet - there seems to be some kind of path problem - but i'ts
| only a matter
| of time now.
|
| Cheers
|
| Mike Thomas.
|
|
|
| | -----Original Message-----
| | From: maxima-admin at www
| | [mailto:maxima-admin@www.ma.utexas.edu]On Behalf Of Mike Thomas
| | Sent: Thursday, March 27, 2003 1:46 PM
| | To: David.Billinghurst@riotinto.com; maxima@www.ma.utexas.edu
| | Subject: RE: [Maxima] Differences between Maxima and Macsyma and GPL vs.
| | commercial version
| |
| |
| | Thanks Dave.
| |
| | | Does the win32 gnuplot support pipes.  It didn't used to, The windows
| | | versions of octave needs (or needed) the pipe-gnuplot.exe untility.
| |
| | The binary downloads of GnuPlot 3.73 and 3.8i I got each contain
| | pgnuplot.exe and wgnuplot.exe, the former of which supposedly works with
| | pipes.  That was the version I used, but I was assuming that it was a
| | standalone executable - I think that may have been a mistake.  I'll try
| | again later with eyes more open.
| |
| | |   * Get a copy of pipe-gnuplot.exe (or, if you want to compile it
| | |     yourself, the corresponding source file pipe-gnuplot.c) from
| | |     ftp://ftp.che.wisc.edu/pub/octave/BINARIES/gnu-win32.
| |
| | That site no longer works, but I got another version of the exe from
| | elsewhere.  It may be that I won't need it however given the above.
| |
| | Cheers
| |
| | Mike Thomas
| |
| |
| | _______________________________________________
| | Maxima mailing list
| | Maxima@www.math.utexas.edu
| | http://www.math.utexas.edu/mailman/listinfo/maxima
| |
| |
|
|
| _______________________________________________
| Maxima mailing list
| Maxima@www.math.utexas.edu
| http://www.math.utexas.edu/mailman/listinfo/maxima
|
|