[OS X TeX] tikz and gnuplot

Richard Koch koch at math.uoregon.edu
Mon Jun 4 00:59:02 CEST 2007


Amaury,

I think I can fix your problem. This is neat: tikz can call gnuplot  
and the combination can
directly typeset plots in a TeX document.

Let me summarize Amaury's message first.

Go to the web site

	http://www.fauskes.net/pgftikzexamples/gnuplot-basics/

where we find an example. Here is complete source with this example.

-----------

\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}

-------------

To typeset this, we need to install gnuplot because the code calls  
gnuplot. In turn, gnuplot
requires aquaterm, so we also install that.

Gnuplot is at

	http://www.versiontracker.com/dyn/moreinfo/macosx/1849

and aquaterm is at

	http://aquaterm.sourceforge.net/

so we install both of them, using friendly Apple install packages.

But now the trouble. Aquaterm has a copy of libaquaterm.1.0.1.dylib  
in its framework, and it makes
a symbolic link to this library in /usr/local/lib. Gnuplot also  
accesses this library, but it expects
libaquaterm.1.0.0.dylib. To fix this problem, we make a symbolic link:

	sudo bash
	cd /usr/local/lib
	ln -s libaquaterm.1.0.1.dylib libaquaterm.1.0.0.dylib

After this, the example typesets fine.

Dick Koch
koch at math.uoregon.edu




------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the macostex-archives mailing list