The program gnuplot was developed to plot data files on a variety of terminals. By setting the terminal to latex, a user can generate plots which can be included in a LaTeX document. A newer driver, eepic, has been developed which generates better looking plots that latex.
The input to gnuplot will be through a file, for example,
gnuplot test.input
The file test.input contains gnuplot commands. An example, which generates a plot for sin(x) follows.
set terminal latex set output "file1.tex" plot sin(x)
To embed the plot in a LaTeX document, include the following.
\begin {figure}[htbp]
\begin {center}
\end {center}
\caption {Simple Example}
\end{figure}
The plot is displayed also.
A slightly more complicated example, which illustrates how to include
mathematical symbols, such as
and
is created using
the following gnuplot commands.
set terminal latex set output "file2" set xlabel "sin($\alpha$)" set ylabel "cos($\beta$)" set title "Sample Plot Showing $\alpha$, $\beta$" plot sin(x) title "sin", cos(x) title "cos"
To use the eepic style, include the following in your documentstyle line, and substitute eepic for latex in your gnu command file.
\documentstyle[eepic,epic]{article}