[OS X TeX] Gnuplot call from within pgfplot

Herbert Schulz herbs at wideopenwest.com
Fri Sep 13 14:03:55 CEST 2013


On Sep 13, 2013, at 6:43 AM, Herbert Schulz <herbs at wideopenwest.com> wrote:

> 
> On Sep 13, 2013, at 6:08 AM, Joshua Smith <smithjh at lafayette.edu> wrote:
> 
>> All,
>> 
>> I am trying to use pgfplots to create a figure, and I am calling gnuplot to evaluate a specified function to create the data, as follows:
>> 
>> \begin{tikzpicture}
>>  \begin{axis}[xmin=0, xmax=0.011, ymin=0, ymax=1.1, scaled x ticks=base 10:3, xtick scale label code/.code={}]
>>    \addplot[\red, very thick] gnuplot[id=convection10, domain=0:0.010, samples=100] {(cosh(sqrt(4 * 100 / 14 / 0.005) * (0.010 - x)) + (100 / sqrt(4 * 100 / 14 / 0.005) / 14) * sinh(sqrt(4 * 100 / 14 / 0.005) * (0.010 - x))) / (cosh(sqrt(4 * 100 / 14 / 0.005) * 0.010) + (100 / sqrt(4 * 100 / 14 / 0.005) / 14) * sinh(sqrt(4 * 100 / 14 / 0.005) * 0.010))};
>>  \end{axis}
>> \end{tikzpicture}
>> 
>> I have installed gnuplot and I can call it manually from a Terminal window.  However, when I compile my TeX file using TeXShop, I get the error:
>> 
>> ./09-13-2013 Main.tex:349: Package pgfplots Error: Sorry, the gnuplot-result file '"09-13-2013 Lecture Notes.convection10.table"' could not be found. Maybe you need to enable the shell-escape feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invoke '>> gnuplot <file>.gnuplot' manually on the respective gnuplot file..
>> 
>> WIthin TeXShop, the engine is set to be
>> 
>> pdflatex --file-line-error --synctex=1 --shell-escape
>> 
>> so, why is gnuplot not being called automatically?
>> 
>> Thanks,
>> Josh
> 
> Howdy,
> 
> Could you provide a complete, minimal example that shows this behavior so I can see all the contents of a file that produces this error?
> 
> Also, what do you mean by `the engine is set to be
> 
> pdflatex --file-line-error --synctex=1 --shell-escape
> 
> and what version of TeXShop and TeX Distribution are you using?
> 
> Good Luck,
> 
> Herb Schulz
> (herbs at wideopenwest dot com)
> 


Howdy,

I have no problem with

%%!TEX TS-program = sepdflatexmk
%%!TEX encoding = UTF-8 Unicode
\documentclass[11pt]{article}
\usepackage{geometry}
\geometry{letterpaper}
\usepackage{graphicx}
\usepackage{amssymb}

\usepackage{tikz}

\title{Brief Article}
\author{The Author}

\begin{document}
\maketitle

\begin{tikzpicture}[domain=0:4,x=2cm,y=2cm]
\draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9);
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$f(x)$};
\draw[color=red] plot[id=x] function{x} node[right] {$f(x) =x$};
\draw[color=blue] plot[id=sin] function{sin(x)} node[right] {$f(x) = \sin x$};
\draw[color=orange] plot[id=exp] function{0.05*exp(x)} node[right] {$f(x) = \frac{1}{20} \mathrm e^x$};
\end{tikzpicture}

\end{document}

Recent versions of TeXShop have shell-escape turned off by default. You may have to enable the sepdflatexmk engine file (it's pdflatexmk with shell-escape enabled). To do this move the sepdflatexmk.engine file from ~/Library/TeXShop/Engines/Inactive/Latexmk two folders higher, to ~/Library/TeXShop/Engines. Under OS X 10.7 and later the ~/Library folder is hidden in Finder by default; to open it press the Option key while you click on the Go Menu in Finder and a new menu item to allow you to open the folder will show up.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)






More information about the macostex-archives mailing list