home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- organization: Pixar -- Marin County, California
- subject: v11i069: Gnuplot 2.0 - 4 of 14
- From: thaw@ucbvax.Berkeley.EDU@pixar.UUCP (Tom Williams)
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 11, Issue 69
- Submitted-by: thaw@ucbvax.Berkeley.EDU@pixar.UUCP (Tom Williams)
- Archive-name: gnuplot2/part04
-
- This is gnuplot.sh04
-
- --- CUT HERE ---
- #! /bin/sh
- echo x - docs/latextut/Makefile
- sed 's/^X//' >docs/latextut/Makefile <<'*-*-END-of-docs/latextut/Makefile-*-*'
- X# Makefile for gnuplot LaTeX tutorial
- X# To make the manual from scratch, we run latex three times
- Xall: tutorial.dvi
- X latex tutorial
- X
- X# To touch it up after changes:
- Xremake: tutorial.dvi
- X
- X# Always runs latex, e.g., to get labels right
- Xforce:
- X latex tutorial
- X
- Xtutorial.dvi: eg1.tex eg2.tex eg3.tex eg4.tex eg5.tex eg6.tex \
- X tutorial.tex header.tex
- X latex tutorial
- X
- X.SUFFIXES: .tex .plt
- X
- X.plt.tex:
- X gnuplot $<
- X
- Xclean:
- X rm -f *~ *.log eg?.tex
- X
- Xspotless:
- X rm -f *~ *.log *.aux *.dvi eg?.tex
- *-*-END-of-docs/latextut/Makefile-*-*
- echo x - docs/latextut/eg1.plt
- sed 's/^X//' >docs/latextut/eg1.plt <<'*-*-END-of-docs/latextut/eg1.plt-*-*'
- Xset terminal latex
- Xset output "eg1.tex"
- Xplot [-3.14:3.14] sin(x)
- *-*-END-of-docs/latextut/eg1.plt-*-*
- echo x - docs/latextut/eg2.plt
- sed 's/^X//' >docs/latextut/eg2.plt <<'*-*-END-of-docs/latextut/eg2.plt-*-*'
- Xset terminal latex
- Xset output "eg2.tex"
- Xset size 5/5., 4/3.
- Xset format xy "$%g$"
- Xset title "This is a plot of $y=sin(x)$"
- Xset xlabel "This is the $x$ axis"
- Xset ylabel "This is\\the\\$y$ axis"
- Xplot [0:6.28] [0:1] sin(x)
- *-*-END-of-docs/latextut/eg2.plt-*-*
- echo x - docs/latextut/eg3.dat
- sed 's/^X//' >docs/latextut/eg3.dat <<'*-*-END-of-docs/latextut/eg3.dat-*-*'
- X-20.000000 -9.125028
- X-19.000000 -9.109280
- X-18.000000 -9.091787
- X-17.000000 -9.072243
- X-16.000000 -9.050265
- X-15.000000 -9.025369
- X-14.000000 -8.996933
- X-13.000000 -8.964147
- X-12.000000 -8.925931
- X-11.000000 -8.880819
- X-10.000000 -8.826766
- X-9.000000 -8.760835
- X-8.000000 -8.678648
- X-7.000000 -8.573396
- X-6.000000 -8.433886
- X-5.000000 -8.240405
- X-4.000000 -7.954906
- X-3.000000 -7.494275
- X-2.000000 -6.642892
- X-1.000000 -4.712389
- X0.000000 0.000000
- X1.000000 4.712389
- X2.000000 6.642892
- X3.000000 7.494275
- X4.000000 7.954906
- X5.000000 8.240405
- X6.000000 8.433886
- X7.000000 8.573396
- X8.000000 8.678648
- X9.000000 8.760835
- X10.000000 8.826766
- X11.000000 8.880819
- X12.000000 8.925931
- X13.000000 8.964147
- X14.000000 8.996933
- X15.000000 9.025369
- X16.000000 9.050265
- X17.000000 9.072243
- X18.000000 9.091787
- X19.000000 9.109280
- *-*-END-of-docs/latextut/eg3.dat-*-*
- echo x - docs/latextut/eg3.plt
- sed 's/^X//' >docs/latextut/eg3.plt <<'*-*-END-of-docs/latextut/eg3.plt-*-*'
- Xset terminal latex
- Xset output "eg3.tex"
- Xset format xy "$%g$"
- Xset title "This is another plot"
- Xset xlabel "$x$ axis"
- Xset ylabel "$y$ axis"
- Xset key 15,-10
- Xplot x with lines, "eg3.dat" with linespoints
- *-*-END-of-docs/latextut/eg3.plt-*-*
- echo x - docs/latextut/eg4.plt
- sed 's/^X//' >docs/latextut/eg4.plt <<'*-*-END-of-docs/latextut/eg4.plt-*-*'
- Xset terminal latex
- Xset output "eg4.tex"
- Xset format y "$%g$"
- Xset format x "$%.2f$"
- Xset title "This is $\sin(x)$"
- Xset xlabel "This is the $x$ axis"
- Xset ylabel "$\sin(x)$"
- Xset nokey
- Xset xtics -pi, pi/4
- Xplot [-pi:pi] [-1:1] sin(x)
- *-*-END-of-docs/latextut/eg4.plt-*-*
- echo x - docs/latextut/eg5.plt
- sed 's/^X//' >docs/latextut/eg5.plt <<'*-*-END-of-docs/latextut/eg5.plt-*-*'
- Xset terminal latex
- Xset output "eg5.tex"
- Xset format y "$%g$"
- Xset format x "$%4.1f\pi$"
- Xset noclip points
- Xset title "This is $\sin(x)$"
- Xset xlabel "This is the $x$ axis"
- Xset ylabel "$\sin(x)$"
- Xset nokey
- Xset xtics ("$-\pi$" -pi,\
- X "$-\frac{\pi}{2}$" -pi/2,\
- X "0" 0,\
- X "$\frac{\pi}{2}$" pi/2,\
- X "$\pi$" pi)
- Xplot [-pi:pi] [-1:1] sin(x)
- *-*-END-of-docs/latextut/eg5.plt-*-*
- echo x - docs/latextut/eg6.plt
- sed 's/^X//' >docs/latextut/eg6.plt <<'*-*-END-of-docs/latextut/eg6.plt-*-*'
- Xset terminal latex
- Xset output "eg6.tex"
- Xset size 3.5/5, 3/3.
- Xset format y "$%g$"
- Xset format x "$%5.1f\mu$"
- Xset title "This is a title"
- Xset xlabel "This is the $x$ axis"
- Xset ylabel "This is\\a longer\\version\\ of\\the $y$\\ axis"
- Xset label "Data" at -5,-5 right
- Xset arrow from -5,-5 to -3.3,-6.7
- Xset key -4,8
- Xset xtic -10,5,10
- Xplot [-10:10] [-10:10] "eg3.dat" title "Data File" with linespoints 1 7,\
- X 3*exp(-x*x)+1 title "$3e^{-x^{2}}+1$" with lines 4
- *-*-END-of-docs/latextut/eg6.plt-*-*
- echo x - docs/latextut/header.tex
- sed 's/^X//' >docs/latextut/header.tex <<'*-*-END-of-docs/latextut/header.tex-*-*'
- X%
- X% Header file for gnutex.tex
- X%
- X
- X% Spacing
- X\newcommand{\singlespace}
- X {\addtolength{\baselineskip}{-.333\baselineskip}}
- X\newcommand{\doublespace}
- X {\addtolength{\baselineskip}{.5\baselineskip}}
- X
- X% Spacing for the whole document
- X\newcommand{\currentspace}{} % use this for single space
- X% \newcommand{\currentspace}{\doubleespace} % use this for double space
- X
- X% Common abbreviations
- X% (Remember to put '\ ' after if an interword space is
- X% desired rather than end-of-sentence space. Same for '.etc)' ).
- X\newcommand{\eg}{{\em e.g.}} % e.g.
- X\newcommand{\ie}{{\em i.e.}} % i.e.
- X\newcommand{\etc}{{\em etc.}} % etc.
- X\newcommand{\vs}{{\em vs.}} % vs.
- X\newcommand{\usec}{{$\mu$}sec} % microseconds
- X
- X% \boxfigure{pos}{wid}{text}: A figure with a box around it
- X%
- X% pos the usual figure placement arg: eg. htbp
- X% wid the width of the figure, in some units: eg. 5in
- X% text the contents of the figure, including picture/caption/label/etc
- X%
- X\newlength{\boxwidth}
- X\newcommand{\boxfigure}[3]{
- X \begin{figure}[#1]
- X \setlength{\boxwidth}{#2}
- X \addtolength{\boxwidth}{.1in}
- X
- X \centering
- X \framebox[\boxwidth]{
- X \begin{minipage}{#2}
- X #3
- X \end{minipage}
- X }
- X \end{figure}
- X}
- X
- X% use \fullboxwidth for arg 2 of boxfigure to get box of size \textwidth
- X
- X% To show a syntax for a gnutex command
- X\newenvironment{syntax}{\begin{quote}\tt}{\end{quote}}
- X
- X\documentstyle[titlepage,11pt]{article}
- X
- X% Margins
- X\sloppy
- X\setlength{\textwidth}{6.5in}
- X\setlength{\textheight}{9in}
- X\setlength{\topmargin}{-0.5in}
- X\setlength{\oddsidemargin}{0pt}
- X\setlength{\evensidemargin}{0pt}
- X
- X% see above
- X\newlength{\fullboxwidth}
- X\setlength{\fullboxwidth}{\textwidth}
- X\addtolength{\fullboxwidth}{-0.1in}
- X
- *-*-END-of-docs/latextut/header.tex-*-*
- echo x - docs/latextut/tutorial.tex
- sed 's/^X//' >docs/latextut/tutorial.tex <<'*-*-END-of-docs/latextut/tutorial.tex-*-*'
- X%
- X% Tutorial for GNUPLOT plotting program, for LaTeX users
- X% David Kotz (dfk@cs.duke.edu)
- X% Duke University Computer Science Department
- X%
- X% NOTE: If LaTeX runs out of memory processing plots,
- X% add ``with lines 4'' to each curve in eg*.plt and rerun make.
- X%
- X
- X% some header info
- X\input{header}
- X
- X\begin{document}
- X
- X\title{\LaTeX\ and the GNUPLOT Plotting
- XProgram\thanks{This document describes GNUPLOT version 2.0. All plots
- Xin this document were made with that version of GNUPLOT.} }
- X\author{David Kotz \\ \verb+dfk@cs.duke.edu+}
- X\date{February 10, 1990}
- X
- X\maketitle
- X
- X\pagestyle{myheadings}
- X\markright{GNUPLOT \LaTeX\ Tutorial Version 2.0}
- X
- X\currentspace % defined in header.tex
- X
- X\section{Introduction and History}
- X
- XGNUPLOT was originally developed by Colin Kelley and Thomas Williams
- Xin 1986 to plot functions and data files on a variety of terminals.
- XIn 1988 and 1989 I created an alternate version, known as Gnu\TeX,
- Xthat supported a new ``terminal type'' called {\tt latex}, so gnuplot
- Xwould output \LaTeX\ code. The plot could then be included in a
- X\LaTeX\ document. I added a number of embellishments, supported only
- Xby the {\tt latex} terminal, allowing the user to produce
- Xpublication-quality plots.
- X
- XIn late 1989 and early 1990 Gnu\TeX\ and a number of other GNUPLOT
- Xvariants were merged together into a new release of GNUPLOT, 2.0. This
- Xincludes, among many other improvements, a \LaTeX\ driver derived from
- Xthe one in Gnu\TeX. Former Gnu\TeX\ users are referred to
- XSection~\ref{oldusers} for information about adapting to GNUPLOT 2.0.
- XAnyone interested in using GNUPLOT 2.0 with \LaTeX\ should read the
- Xnext section, a tutorial. GNUPLOT beginners should also read the
- Xprimary GNUPLOT manual.
- X
- XThe reader should note that the \LaTeX\ picture environments output by
- XGNUPLOT can be quite large and complicated, and can easily exceed the
- Xmemory capacity of \TeX. If an enlarged version of \TeX\ is available,
- Xit is wise to use it. Otherwise, keep your plots simple and add
- X\verb+\clearpage+ to your document where necessary.
- X
- XThere is also a new EEPIC driver ({\tt eepic}), intended for use with
- Xthe EEPIC macro package for \LaTeX. EEPIC allows for much more
- Xefficient line-drawing, runs through \LaTeX\ faster, uses less memory,
- Xand may produce better-looking plots. See Section~\ref{s:eepic} for
- Xmore information.
- X
- X\section{Using GNUPLOT for \LaTeX: a Tutorial}
- X
- XGNUPLOT is by nature an interactive program. Users making plots for
- X\LaTeX\ will generally not use GNUPLOT interactively. Whenever hard
- Xcopy is desired from GNUPLOT, the program need not be run on a
- Xgraphics terminal. In this case the output is directed to a file or
- Xpipe, then sent to the appropriate output device. For example, output
- Xfrom the terminal type {\tt unixplot} may be sent to a program
- Xinterpreting the Unix plotting standard. The terminal types {\tt
- Ximagen} and {\tt postscript} may be used for output to printers
- Xunderstanding those languages. (A shell script ({\tt lasergnu}) is
- Xsupplied with the distribution that will accept a GNUPLOT command or
- Xinput file and send the output to an Imagen or Postscript laser
- Xprinter. This script may have been adapted to your site.) The terminal
- Xtype {\tt fig} outputs FIG code that can be read by the Fig graphics
- Xprogram and translated into forms usable in both \TeX\ and
- X\LaTeX\ documents.
- X
- XWe now ignore the interactive nature of GNUPLOT and provide the input
- Xto GNUPLOT from a file, \ie,
- X\begin{verbatim}
- X gnuplot gnu.input
- X\end{verbatim}
- XIn this example, all of the commands to GNUPLOT are contained in the
- Xfile {\tt gnu.input}. Multiple filenames may be supplied to GNUPLOT
- Xthis way, read in the order they are given. The output (one or more
- Xplots) may be piped to another program or redirected to a file.
- XUsually, however, we direct the output explicitly with an instruction
- Xto GNUPLOT (the {\tt set output} command). GNUPLOT continues to print
- Xerror messages to the terminal (stderr).
- X
- X\paragraph{Example 1:} Here is a first example, producing a plot for
- Xthis document. The GNUPLOT input file is given below, and the output
- Xappears as Figure~\ref{eg1}. The input file defines the output to be
- Xin \LaTeX, gives a file name for the output, and plots $y=sin(x)$ for
- X$x$ on $[-\pi,\pi]$. To produce the figure, I simply
- X\verb+\input{eg1}+ in a {\tt center} environment in a {\tt figure}
- Xenvironment. In following examples, I will enclose the figure in a box
- Xto make it look a little better.
- X
- X\singlespace
- X\begin{verbatim}
- X set terminal latex
- X set output "eg1.tex"
- X plot [-3.14:3.14] sin(x)
- X\end{verbatim}
- X\currentspace
- X
- X\begin{figure}[htbp]
- X \begin{center}
- X \input{eg1}
- X \end{center}
- X \caption{A first example: $y=sin(x)$}
- X \label{eg1}
- X\end{figure}
- X
- XNote that GNUPLOT has drawn in the axes, labeled the tic marks for us,
- Xscaled the $y$ axis automatically, and added a key in the
- Xupper-right-hand corner (this may be moved with the {\tt set key}
- Xcommand).
- X
- XThis is the default line style for the \LaTeX\ driver. Because of the
- Xlimited picture capabilities of \LaTeX, many dots are required to
- Xapproximate drawing a solid line. This may overload the memory of many
- X\TeX\ implementations. There are other line types available that draw
- Xdotted lines and use much less memory. The EEPIC driver draws solid
- Xlines with much less memory usage.
- X
- X\paragraph{Example 2:} Now we will embellish the plot a little with
- Xsome labels. This input file produces Figure~\ref{eg2}.
- X
- X\singlespace
- X\begin{verbatim}
- X set terminal latex
- X set output "eg2.tex"
- X set size 5/5., 4/3.
- X set format xy "$%g$"
- X set title "This is a plot of $y=sin(x)$"
- X set xlabel "This is the $x$ axis"
- X set ylabel "This is\\the\\$y$ axis"
- X plot [0:6.28] [0:1] sin(x)
- X\end{verbatim}
- X\currentspace
- X
- X\boxfigure{htbp}{\fullboxwidth}{
- X \begin{center}
- X \input{eg2}
- X \end{center}
- X \caption{A more fancy example.}
- X \label{eg2}
- X}
- X
- XWe have specified the plot to be 5 inches wide and 4 inches tall with
- Xthe {\tt set size} command. This is the size of the area used by the
- Xplot, {\em including} space for the labels. In the first example,
- Xthis size was the default 5 inches by 3 inches. By specifying the
- Xscaling factors of 1 (or 5/5) and 1.3333 (or 4/3), we obtain the
- Xdesired plot size.
- X
- XWe have requested that the format used by the $x$- and $y$-axis tic
- Xmark labels be in \LaTeX\ math mode. This makes the labels look a
- Xlittle better. The default is \verb+set format xy "%g"+. The \verb+%g+
- Xrepresents the general-purpose floating point formatting specification
- Xfor the {\tt printf} function in C. Any valid floating-point
- Xformatting specification, or \LaTeX\ command, is allowed in the
- Xformat.
- X
- XA title for the plot and labels for the axes were set up in the next
- Xthree commands. Note that they are processed by \LaTeX\ and so may
- Xhave math mode and other symbols in them. The ylabel may have multiple
- Xlines, delineated with \verb+\\+. Once these are set up, they will be
- Xused for all subsequent plot commands until they are changed. These
- Xlabels are also supported by the other terminal types, but (of course)
- Xany \LaTeX\ code in the string will not be interpreted. We have also
- Xdefined the range of both $x$ (now $[0,2\pi]$) and $y$ (here $[0,1]$).
- X
- XSo far we have plotted one curve, $y=\sin(x)$, on one plot. In
- XGNUPLOT, each {\tt plot} command generates a new plot. If the output
- Xis to a screen, the screen is cleared. If to a printer, a new page is
- Xproduced. In the {\tt latex} case, a new picture is started. It is not
- Xlikely that \LaTeX\ users will want this to happen, so generally each
- Xplot has its own input file and is kept in a separate output ({\tt
- X.tex}) file for inclusion at different places in the document.
- X
- X\paragraph{Example 3:} To place more than one curve on a plot, use one
- X{\tt plot} statement and separate the description of each curve by a
- Xcomma. In our next example, we will plot both a function and a data
- Xfile on the same plot. This plot is shown in Figure~\ref{eg3}.
- X
- X\singlespace
- X\begin{verbatim}
- X set terminal latex
- X set output "eg3.tex"
- X set format xy "$%g$"
- X set title "This is another plot"
- X set xlabel "$x$ axis"
- X set ylabel "$y$ axis"
- X set key 15,-10
- X plot x with lines, "eg3.dat" with linespoints
- X\end{verbatim}
- X\currentspace
- X
- X\boxfigure{htbp}{\fullboxwidth}{
- X \begin{center}
- X \input{eg3}
- X \end{center}
- X \caption{An example with two curves on the same plot.}
- X \label{eg3}
- X}
- X
- XHere you will see that the $x$ range was not specified. The $x$ range
- Xis determined automatically, unless specified by the user. In
- Xthis case, it is defined by the range of the data file
- X\verb+"eg3.dat"+. The function is plotted over the same range. If no
- Xdata files or $x$ range are supplied, the default range of $[-10:10]$
- Xis used. We have also moved the key to a different position. The
- Xfunction $y=x$ is plotted ``with lines'', which is the default plot
- Xstyle for functions, and is shown here to illustrate the plot style
- Xoption. The data file {\tt eg3.dat} is plotted with style {\tt
- Xlinespoints}, a style like {\tt lines} that also plots a symbol at
- Xeach data point.
- X
- XThere is a style called {\tt points} that only plots the symbols at
- Xdata points, and another called {\tt dots} that plots a tiny dot for
- Xeach data point. The {\tt points} and {\tt linespoints} styles
- Xproduce a different point symbol for each curve on the plot (for up to
- Xtwelve symbols, after which they are re-used). The {\tt lines} and
- X{\tt linespoints} styles use a different line style for each curve on
- Xthe plot (in this example the dots have different spacing). Finally,
- Xthe style {\tt impulses} draws a perpendicular from each point to the
- X$x$-axis.
- X
- X\paragraph{Example 4:} In the above plots of $\sin(x)$, it would make
- Xmore sense to label the axis in units of $\pi$. The position and
- Xlabels of the tic labels may be specified by the user, with the {\tt
- Xset xtics} and {\tt set ytics} commands. This is demonstrated by
- Xthe following example, shown in Figure~\ref{eg4}.
- X
- X\singlespace
- X\begin{verbatim}
- X set terminal latex
- X set output "eg4.tex"
- X set format y "$%g$"
- X set format x "$%.2f$"
- X set title "This is $\sin(x)$"
- X set xlabel "This is the $x$ axis"
- X set ylabel "$\sin(x)$"
- X set nokey
- X set xtics -pi, pi/4
- X plot [-pi:pi] [-1:1] sin(x)
- X\end{verbatim}
- X\currentspace
- X
- X\boxfigure{htbp}{\fullboxwidth}{
- X \begin{center}
- X \input{eg4}
- X \end{center}
- X \caption{An example of the {\tt set xtics} command.}
- X \label{eg4}
- X}
- X
- XSince {\tt pi} is a predefined variable in GNUPLOT, we can use it
- Xanywhere we may use an expression. The {\tt set xtics} command here
- Xspecifies that the tics on the $x$ axis start at $-\pi$ and increment
- Xby $\pi/4$. Since no end point is given, the tics continue to the
- Xright edge. We have also turned off the key, and changed the format to
- Xrestrict the $x$-axis tic labels to 2 decimal places.
- X
- XWith a little more work, the plot can look even better. Another form
- Xof this command allows us to specify the label and position of each
- Xtic individually. Replacing the above {\tt set xtics} command with
- Xthe following gives us Figure~\ref{eg5}. We also make use of the line
- Xcontinuation character, the backslash (\verb+\+), to spread out this
- Xcommand for readability.
- X
- X\singlespace
- X\begin{verbatim}
- X set xtics ("$-\pi$" -pi,\
- X "$-\frac{\pi}{2}$" -pi/2,\
- X "0" 0,\
- X "$\frac{\pi}{2}$" pi/2,\
- X "$\pi$" pi)
- X\end{verbatim}
- X\currentspace
- X
- X\boxfigure{htbp}{\fullboxwidth}{
- X \begin{center}
- X \input{eg5}
- X \end{center}
- X \caption{A fancy example of the {\tt set xtics} command.}
- X \label{eg5}
- X}
- X
- X\paragraph{Going further:} You should now be able to make a variety of
- Xplots for your \LaTeX\ document. We will present a final example
- Xwithout explanation that showcases some of the capabilities of
- XGNUPLOT. You may find documentation for the various commands in the
- XGNUPLOT manual, though hopefully this example is somewhat
- Xself-explanatory. This is shown in Figure~\ref{eg6}.
- X
- X\singlespace
- X\begin{verbatim}
- X set terminal latex
- X set output "eg6.tex"
- X set size 3.5/5, 3/3.
- X set format y "$%g$"
- X set format x "$%5.1f\mu$"
- X set title "This is a title"
- X set xlabel "This is the $x$ axis"
- X set ylabel "This is\\a longer\\version\\ of\\the $y$\\ axis"
- X set label "Data" at -5,-5 right
- X set arrow from -5,-5 to -3.3,-6.7
- X set key -4,8
- X set xtic -10,5,10
- X plot [-10:10] [-10:10] "eg3.dat" title "Data File" with linespoints 1 7,\
- X 3*exp(-x*x)+1 title "$3e^{-x^{2}}+1$" with lines 4
- X\end{verbatim}
- X\currentspace
- X
- X\boxfigure{htbp}{\fullboxwidth}{
- X \begin{center}
- X \input{eg6}
- X \end{center}
- X \caption{An example of many features.}
- X \label{eg6}
- X}
- X
- X\subsection{Summary --- Use with \LaTeX}
- XIn summary, to use the \LaTeX\ facilities of GNUPLOT, the first
- Xcommand to GNUPLOT should be
- X\begin{syntax}
- X set terminal latex
- X\end{syntax}
- Xand the output of GNUPLOT should be directed to a file, for example,
- X\begin{verbatim}
- X set output "plot.tex"
- X\end{verbatim}
- XThis may be anything you like but it should have a {\tt .tex} extension,
- Xof course. Then the size of the plot should be given. For example, the
- Xcommand
- X\begin{verbatim}
- X set size 1,2
- X\end{verbatim}
- Xtells GNUPLOT to use a 5 inch wide by 6 inch high box for the plot.
- XThe numbers given are {\em scale factors}, not the actual size. The
- Xdefault is 5 inches by 3 inches. This is the size of the complete
- Xplot, including all labels.
- X
- XWhen finished, the file will contain all of the plots you have
- Xspecified (you probably only want one plot per file). This file can
- Xthen be used in a \LaTeX\ document, \eg,
- X
- X\singlespace
- X\begin{verbatim}
- X \begin {figure}
- X \begin{center}
- X \input{plot}
- X \end{center}
- X \end {figure}
- X\end{verbatim}
- X\currentspace
- XThis puts the plot into a figure.
- X
- XYou will also want to read about the following commands: {\tt set
- Xtitle, set xlabel, set ylabel, set key, set label, set xtics, set
- Xytics}, and {\tt set clip}. These are all described in the regular
- XGNUPLOT manual.
- X
- X\section{Use with EEPIC}
- X\label{s:eepic}
- XEEPIC is a macro package extending the picture environment of \LaTeX.
- XIf you have the EPIC or EEPIC macros, and your {\tt dvi} translator
- Xsupports the {\em tpic\/} \verb+\special+s, then you have the possible
- Xcapability for better-quality output. With EEPIC pictures, the {\tt
- Xplot.tex} file will be smaller, \LaTeX\ will run much faster (and need
- Xmuch less memory), and the {\tt dvi} file will be smaller.
- X
- XTo use EEPIC, set GNUPLOT's terminal type to {\tt eepic} instead of
- X{\tt latex}, and use GNUPLOT as before. The line styles will change.
- XInclude the file {\tt plot.tex} in your document as before, along with
- Xthe document style options {\tt [epic,eepic]}.
- X
- XThis driver should be considered experimental.
- X
- X\section{For Former Gnu\TeX\ Users}
- X\label{oldusers}
- X
- XFormer Gnu\TeX\ users may be pleased with many of the new features
- X(many inspired by your suggestions!), but will also find many changes.
- XGNUPLOT will {\em not\/} run all Gnu\TeX\ input files unchanged.
- XSeveral Gnu\TeX\ features were not included in GNUPLOT because they
- Xwere specific to the \LaTeX\ driver. I encourage you to use the newer
- XGNUPLOT. A translator is supplied with the GNUPLOT distribution that
- Xattempts to translate your old Gnu\TeX\ 1.6 input files into GNUPLOT
- X2.0 files.
- X
- XNote also the new EEPIC driver (Section~\ref{s:eepic}).
- X
- X\subsection{The Differences}
- X\begin{itemize}
- X\item The {\tt key} command was replaced by the {\tt set key}
- Xcommand, and should therefore precede any {\tt plot} commands. A key
- Xis shown by default, and can be turned off with {\tt set nokey}. The
- Xposition specified is now the top center of the key, instead of the
- Xbottom center. The titles and styles of the curves are extracted from
- Xthe {\tt plot} command.
- X\item The {\tt label} command was replaced by the {\tt set label}
- Xcommand. The syntax is slightly different. Left, right, and center
- Xjustification are still available, but only vertical centering is
- Xpossible. Arrows are defined by the reference point of the label and
- Xan ending point. This allows arbitrary slope arrows to be drawn.
- XSince \LaTeX\ limits arrows (vectors) to particular slopes, we draw
- Xnon-standard-slope arrows with the solid plot line type, and then add
- Xan arrowhead. This will require less memory with the EEPIC driver.
- X\item The user-defined style facility, controlled by {\tt set style},
- Xis completely removed. This was too specific to the \LaTeX\ driver to
- Xbe kept in this GNUPLOT release. The \LaTeX\ driver now supports
- Xvarious line types in the {\tt lines} and {\tt linespoints} styles.
- XSolid lines are the default, with higher-numbered styles providing
- Xdotted lines. These solid lines are expensive. Avoid them if you run
- Xinto memory or time difficulties, or try the EEPIC driver. The
- X\LaTeX\ driver currently supports 6 point types (numbered 7-12) in
- Xaddition to the 6 original GNUPLOT points (numbered 1-6). This set may
- Xbe extended, so do not depend on wrap-around for point styles over 12.
- X\item Multiple-line xlabels and titles, specified with \verb+\\+, are
- Xnot permitted. They are still allowed in the ylabel. The ylabel {\tt
- Xskip} parameter, however, is not available, so the ylabel is in a
- Xfixed position.
- X\item The {\tt set size} command takes a pair of scale factors, rather
- Xthan absolute sizes. The default size is 5 inches wide by 3 inches
- Xhigh. In addition, this size is now the size of the entire plot,
- Xincluding labels, not just the box defining the plotting area. So you
- Xneed to specify a size a little larger than before, in particular
- Xwider. The easiest way to convert is to use the translator (see
- Xbelow).
- X\item Clipping has been expanded. A {\tt lines}-style curve that
- Xcrossed out of the plotting area used to be cut at the last in-range
- Xpoint, to be continued at the next in-range point. Now the curve is
- Xdrawn from the last in-range point to the edge, toward the
- Xout-of-range point. Similarly for returning from out-of-range to
- Xin-range. A segment of the curve crossing the plotting area but
- Xbeginning outside and ending outside may also be shown. These are all
- Xuser-controlled. Read about {\tt set clip}.
- X\item The default tic label format is ``\%g'', instead of ``\$\%g\$''.
- X\item Ten-point roman (\verb+\tenrm+) is the default font for all text
- Xand symbols in the plot.
- X\item Non-interactive behavior, including error messages, has been
- Xmuch improved. Input files may be specified as command-line arguments,
- Xas well as through redirection.
- X\item The help system was completely revamped.
- X\item New features (see the GNUPLOT manual):
- X \begin{itemize}
- X \item The {\tt replot} command.
- X \item The {\tt save} command has been expanded.
- X \item The factorial operator.
- X \item The {\tt pause} command.
- X \item The {\tt set dummy} command.
- X \item The {\tt set tics} command.
- X \item The {\tt set xtics} and {\tt set ytics} commands.
- X \item The {\tt set offsets} command.
- X \item The {\tt set grid} command.
- X \item The {\tt set polar} command.
- X \item The {\tt title} option on the {\tt plot} command to
- X specify the title of the curve (for use in the key).
- X \item The line-type and point-type options to the {\tt with} option
- X of the {\tt plot} command.
- X \item Breaks are specified in data files with blank lines.
- X \item The logical operators now short-circuit, thus
- X\begin{verbatim}
- X x = 4
- X y = (x != 4 && 10/(x-4) < 0)
- X\end{verbatim}
- X gives y a value of false (0), instead of causing an error.
- X \end{itemize}
- X
- X\end{itemize}
- X
- X\subsection{The Translator}
- XI have provided a translation program, {\tt gnut2p}, to convert gnutex
- Xfiles to gnuplot files. This program does its best, but is not
- Xperfect. Most of gnutex will translate directly, some things will
- Xtranslated easily (such as {\tt set size}), but some things cannot be
- Xtranslated (such as {\tt set style}). This program moves plot
- Xcommands down past the {\tt label} and {\tt key} commands (which
- Xchange into {\tt set label} and {\tt set key} commands). This may move
- Xit past other commands. If it moves past variable or function
- Xdefinitions, {\tt set} commands, or other commands which affect the
- Xplot command's execution, then the new version will be incorrect. I
- Xexpect this case to be rare; indeed, I generally expect the last lines
- Xin Gnu\TeX\ input files used with \LaTeX\ to consist of {\tt plot,
- Xlabel,} and {\tt key} commands.
- X
- XThe usage of this program is simple:
- X\begin{verbatim}
- X gnut2p infile outfile
- X\end{verbatim}
- X{\tt infile} is an existing Gnu\TeX\ file, and {\tt outfile} will be
- Xcreated as the GNUPLOT equivalent. The errors, warnings, and
- Xexplanatory comments appear on stderr. Any use of line continuation
- Xwill be lost, and some instances of the input style (\eg, white space)
- Xmay be changed.
- X
- X\section{Contact}
- XPlease contact me at dfk@cs.duke.edu with any comments you may have.
- X
- X\end{document}
- *-*-END-of-docs/latextut/tutorial.tex-*-*
- exit
-
-
-