Re: Piping commands to gnuplot through the shell

*To*: mathgroup at smc.vnet.net*Subject*: [mg67514] Re: Piping commands to gnuplot through the shell*From*: "James Gilmore" <james.gilmore at yale.edu>*Date*: Thu, 29 Jun 2006 00:09:33 -0400 (EDT)*Organization*: Yale University*References*: <e7nntq$965$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi, I dont have any answer to your question. Just wondering why you would need to pipe to gnuplot in the first place? Mathematica has a nice built in graphics system, that could be tailored to suit your needs. Are you producing a graphics style that Mathematica cannot construct? If so could you send me a copy so I could take a look? Cheers James "MDP" <news.x.zokota at spameater.org> wrote in message news:e7nntq$965$1 at smc.vnet.net... > Hello, > > I am currently writing some Mathematica code that will plot data with > gnuplot instead of the internal plotting functions. I have successfully > written a function that opens the gnuplot pipes executable as a stream > where > I can send it a list of arbitrary commands and end up with my desired > output. This is great for making presentation quality plots but the > problem > is that after the function ends and gnuplot is exited there is still a > process running as indicated by Windows Task Manager. The window that > gets > opened during command piping gets closed but the executable does not and I > can't figure out what I'm doing wrong. If I run the function multiple > times > I end up with multiple processes running so each time I use > pstream=OpenWrite["!pgnuplot"] Mathematica starts a new process that > Close[pstream] doesn't seem to stop. Does anyone have an idea how to > close > it or any ideas on how I could run gnuplot through Mathematica a better > way? > Thanks for any insight... here is my code: > > gnuplot2D[data_, opts___] := Module[ > { > gnuplotDirectory = "c:/program > files/gnuplot/bin/", tempDirectory = "c:/program files/gnuplot/"=, > aspectRatio = gnuplotAspectRatio /. {opts} /. \ > Options[gnuplotScatter], > commands, j, thePlot > }, > > commands = {"reset", > > "set datafile separator \",\"", > "set size ratio " <> ToString[N[aspectRatio, 3 ]], > "set terminal postscript eps enhanced color \"ArialMT\" 24", > "set output \"" <> tempDirectory <> "temp.eps" <> "\"", > "plot \"" <> tempDirectory <> "temp.csv" <> "\" matrix > notitle", > "quit"}; > > SetDirectory[tempDirectory]; > Export["temp.csv", data]; > SetDirectory[gnuplotDirectory]; > pstream = OpenWrite["!pgnuplot"]; > For[j = 1, j =E2=89=A4 Length[commands], j++, OutputForm[ > commands[[j]]] >> !pgnuplot;]; > Close[pstream]; > SetDirectory[tempDirectory]; > Run["del temp.csv"]; > ]; > > Options[gnuplotScatter] = {gnuplotAspectRatio -> 1/GoldenRatio}; >