next up previous contents
Next: Embedding Postscript Images Up: New User Documentation Center Previous: Introduction to LaTeX

Embedding Plots

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.

h
Here: at the position in the text where the environment appears.
t
Top: at the top of a text page.
b
Bottom: at the bottom of a text page.
p
Page: on a separate page, which only includes figures and tables (no text).

   figure561
Figure 1: Simple Example

A slightly more complicated example, which illustrates how to include mathematical symbols, such as tex2html_wrap_inline10477 and tex2html_wrap_inline10479 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"

   figure2726
Figure 2: Another Example

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}



Darla K. Kuras
Thu Jul 23 11:09:59 EDT 1998