Math & Science ⇒ Calling Gnuplot out of LaTeX directly
Calling Gnuplot out of LaTeX directly
Dear All
I cannot call gnuplot by using my latex
My configuration: Miktex 2.7 with texmaker 1.9.2 and texniccenter 1.0 , gnuplot version 2.4 patchlevel 5
windows XP (SP3) Home Edition Japanese version.
I have tried to:
- make in line command
-enable-write18 , --enable-write18
-shell-escape , --shell-escape
-shell-escape -enable-write18
--shell-escape -enable-write18
- I also have make path for gnuplot in windows environment.
But until now, it is useless.
I can call gnuplot from win+R but Latex seem protect itself from gnuplot.
Anybody can help me? i am so frustrated with this condition as I have tried to solve it for 5 whole days.
Best Regards
-Hendri-
I cannot call gnuplot by using my latex
My configuration: Miktex 2.7 with texmaker 1.9.2 and texniccenter 1.0 , gnuplot version 2.4 patchlevel 5
windows XP (SP3) Home Edition Japanese version.
I have tried to:
- make in line command
-enable-write18 , --enable-write18
-shell-escape , --shell-escape
-shell-escape -enable-write18
--shell-escape -enable-write18
- I also have make path for gnuplot in windows environment.
But until now, it is useless.
I can call gnuplot from win+R but Latex seem protect itself from gnuplot.
Anybody can help me? i am so frustrated with this condition as I have tried to solve it for 5 whole days.
Best Regards
-Hendri-
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Calling Gnuplot out of LaTeX directly
Generally on a MiKTeX system the switch to escape to the command prompt looks like the following.
This enables the MiKTeX compiler to call external programs and scripts.
In the README.Windows file that comes with the Gnuplot archive it is suggested to use pgnuplot.exe for external calls. The first required step would be to rename this file to gnuplot.exe because packages like gnuplottex need it to be named this way. Another important requirement is that the executable can be found. Thus the path to the executable needs to be added to the PATH environment variable. Check the success by opening a command prompt and calling the program.
In case the program starts successfully, LaTeX will also find it.
Best regards and welcome to the board
Thorsten
Code: Select all
latex --enable-write18 filename.tex
In the README.Windows file that comes with the Gnuplot archive it is suggested to use pgnuplot.exe for external calls. The first required step would be to rename this file to gnuplot.exe because packages like gnuplottex need it to be named this way. Another important requirement is that the executable can be found. Thus the path to the executable needs to be added to the PATH environment variable. Check the success by opening a command prompt and calling the program.
Code: Select all
gnuplot
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Calling Gnuplot out of LaTeX directly
Dear Thorsten,
I can call gnuplot from Win+R . it means gnuplot is OK, but the problem is my Text editor (Texmaker, TexnicCentre) cannot call gnuplot..
In my Windows XP english version this case not happen.
Best Regards/Hendri
I can call gnuplot from Win+R . it means gnuplot is OK, but the problem is my Text editor (Texmaker, TexnicCentre) cannot call gnuplot..
In my Windows XP english version this case not happen.
Best Regards/Hendri
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: Calling Gnuplot out of LaTeX directly
Please, enlighten me about "Win+R". That might be a key combination or something else. I don't know.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Site Moderator
- Posts: 814
- Joined: Tue Jul 01, 2008 2:19 pm
Re: Calling Gnuplot out of LaTeX directly
Win + R = "Run ..." on Windows (similar to a "Launch" dialogue on some Linux systems).
Joseph Wright
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Calling Gnuplot out of LaTeX directly
Many thanks. Well, if Gnuplot can be called from there, it should also run in a command prompt thus it should also run when called by a LaTeX editor.josephwright wrote:Win + R = "Run ..." on Windows (similar to a "Launch" dialogue on some Linux systems).
limpato, you should describe your efforts how you tried to execute Gnuplot out of a LaTeX IDE. I only know how to do this with a package like I mentioned earlier. The best is to build a minimal working example (MWE) that relies on external plots done by Gnuplot.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Calling Gnuplot out of LaTeX directly
I dont know why i always get the problem with calling gnuplot in LaTex. In Windows XP system (Japanese version) after discussion with many users. The solution for me are:
a. Write " $% -shell-escape " in the top of tex file
b. Dont make name of file in more than one word. For example " plot.tex " is OK, but " plot basic.tex " will fail to call gnuplot.
Now, I try to use Ubuntu 10.4 with Texmaker 1.9.9 and gnuplot 4.4.0 and the above solution solution above is useless now. I try to use " %& -enable-write18 " too, but still not succesful.
This is log message after Run Quick Build in Texmaker of Ubuntu 10.4 system.
-----
\openout3 = `plot.x.gnuplot'.
runsystem(gnuplot plot.x.gnuplot)...disabled (restricted).
Package pgf Warning: Plot data file `plot.x.table' not found. on input line 19.
\openout3 = `plot.sin.gnuplot'.
runsystem(gnuplot plot.sin.gnuplot)...disabled (restricted).
Package pgf Warning: Plot data file `plot.sin.table' not found. on input line 2
1.
\openout3 = `plot.exp.gnuplot'.
runsystem(gnuplot plot.exp.gnuplot)...disabled (restricted).
Package pgf Warning: Plot data file `plot.exp.table' not found. on input line 2
3.
-----
Anybody knows how to solve this problem? As I am newbie in Linux, please give me explanation from beginning to end if you have solution.
Thank you..
a. Write " $% -shell-escape " in the top of tex file
b. Dont make name of file in more than one word. For example " plot.tex " is OK, but " plot basic.tex " will fail to call gnuplot.
Now, I try to use Ubuntu 10.4 with Texmaker 1.9.9 and gnuplot 4.4.0 and the above solution solution above is useless now. I try to use " %& -enable-write18 " too, but still not succesful.
This is log message after Run Quick Build in Texmaker of Ubuntu 10.4 system.
-----
\openout3 = `plot.x.gnuplot'.
runsystem(gnuplot plot.x.gnuplot)...disabled (restricted).
Package pgf Warning: Plot data file `plot.x.table' not found. on input line 19.
\openout3 = `plot.sin.gnuplot'.
runsystem(gnuplot plot.sin.gnuplot)...disabled (restricted).
Package pgf Warning: Plot data file `plot.sin.table' not found. on input line 2
1.
\openout3 = `plot.exp.gnuplot'.
runsystem(gnuplot plot.exp.gnuplot)...disabled (restricted).
Package pgf Warning: Plot data file `plot.exp.table' not found. on input line 2
3.
-----
Anybody knows how to solve this problem? As I am newbie in Linux, please give me explanation from beginning to end if you have solution.
Thank you..