5

When I use Tikz to plot a function. I followed the instruction to use gnuplot to do so. I did that half year before. But now when I recompile, the gnuplot has problem with the first line of its generated .gnuplot file:

set terminal table

Does anyone know the problem? My gnuplot version is 4.4 patchlevel 2. Do I need to use an older version?

Thank you very much!

EDIT: my file is here:

A minimal example

\documentclass{minimal}

\usepackage{graphicx,url,psfrag}
\usepackage[noxcolor,usenames]{pstricks}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,calc,decorations.fractals,through}
\usepgflibrary{plotmarks}
\usepackage{pgfmath}
\usepackage{amsmath,amssymb,amsthm,amscd}

\pagestyle{empty}

\begin{document}

\def\tI{1}
\def\xI{3}
\def\tII{2}
\def\xII{1}

\begin{tikzpicture}[scale=0.7,domain=\tII:5]

\draw[help lines,step=1] (0,-3) grid (5,5.5);
\draw [->] (-0.5,0) -- (0,0) coordinate [label=-135:$O$] (O) -- (6,0)
coordinate [label=right:$t$] (T);
\draw [->] (0,-3.2)  -- (0,6) coordinate [label=above:$x$] (X);

\draw [dashed,thick] (0,\xI) coordinate [label=left:$x_1$] -- (\tI,\xI) --
(\tI,0) coordinate [label=below:$t_1$] ;
\draw [dashed,thick] (0,\xII) coordinate [label=left:$x_2$] -- (\tII,\xII) --
(\tII,0) coordinate [label=below:$t_2$] ;

\foreach \r in {-3,-2,-1,0,1,2,3}
{
\draw plot [id=HeatSample-\r]
function{
((x-\tI)*\xII+(x-\tII)*\xI)/(2*x-\tI-\tII)+sqrt((x-\tI)*(x-\tII)/(2*x-\tI-\tII)
) * \r} node [right] {$\r$};
}

\end{tikzpicture}
\end{document}

Even with the basic examples in http://www.texample.net/tikz/examples/tag/gnuplot/, my system has problems with

set terminal table;

I think it is the problem of my gnuplot

3

Following up on Thorsten's answer, a work around is to explicitly change this in the pgf file that calls gnuplot. For my texlive installation, the file I had to change is:

/usr/share/texmf/tex/generic/pgf/basiclayer/pgfbaseplot.code.tex

Change this line:

\xdef\pgf@gnuplot@head#1{set terminal table; set output "#1.table"; set format "%.5f"}

to this:

\xdef\pgf@gnuplot@head#1{set table; set output "#1.table"; set format "%.5f"}
4

Make sure that you have Version 2.10 of pgf/tikZ installed to make it work with current versions of Gnuplot. In these versions (I guess since 4.4.0) the setting of the »table« terminal in Gnuplot has changed from set terminal table to set table. Actually there should be some information about that in the log file.

  • Yes, It is. Now it works. Thanks a lot! :-) – Anand Jul 23 '11 at 13:32
1

After reading the post: TikZ + gnuplot on a Mac

I change the line

\xdef\pgf@gnuplot@head#1{set terminal table; set output “#1.table”; set format “%.5f”} 

to

\xdef\pgf@gnuplot@head#1{set table; set output “#1.table”; set format “%.5f”} 

in the file /usr/share/texmf/tex/generic/pgf/modules/pgfmoduleplot.code.tex.

Then it works well again.

Thanks Thorsten!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.