FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Updates about TeX-friendly terminals in gnuplot 4.0. · gnuplot/gnuplot@a41aab1 · GitHub

Repository navigation

Commit a41aab1

Browse files
Petr Mikulik
committed
Updates about TeX-friendly terminals in gnuplot 4.0.
1 parent c27f08f commit a41aab1

3 files changed

Lines changed: 132 additions & 58 deletions

File tree

‎ChangeLog‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
2004-03-11 Petr Mikulik <mikulik@physics.muni.cz>
22

3+
* tutorial/tutorial.tex tutorial/header.tex: Updates about TeX-friendly
4+
terminals in gnuplot 4.0.
5+
36
* term/gd.trm term/gif.trm: Don't print debugging message.
47

58
2004-03-10 Ethan Merritt <merritt@u.washington.edu>

‎tutorial/header.tex‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
%\usepackage{pspicture}
6767
\fi
6868

69+
% Other packages
70+
\usepackage{url}
71+
6972
% Margins
7073
\sloppy
7174
\setlength{\textwidth}{6.5in}

‎tutorial/tutorial.tex‎

Lines changed: 126 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,60 @@
11
%
2-
% Tutorial for GNUPLOT plotting program, for LaTeX users
2+
% $Id: $
3+
%
4+
% Tutorial for gnuplot plotting program, for LaTeX users
35
% David Kotz
46
% Duke University Computer Science Department
57
%
8+
% Slightly updated by the gnuplot team in 2004, for gnuplot 4.0.
9+
%
610
% NOTE: If LaTeX runs out of memory processing plots,
711
% add ``with lines 4'' to each curve in eg*.plt and rerun make.
812
%
913

1014
% some header info
1115
\input{header}
1216

17+
1318
\begin{document}
1419

15-
\title{\LaTeX\ and the GNUPLOT Plotting
16-
Program\thanks{This document describes GNUPLOT version 3.0. All plots
17-
in this document were made with that version of GNUPLOT.} }
18-
\author{David Kotz}
19-
\date{July 3, 1991}
2020

21-
\maketitle
21+
\begin{titlepage}
22+
23+
\begin{center}
24+
{\Large \bf \LaTeX\ and the Gnuplot Plotting Program}
25+
26+
\vskip2cm
27+
28+
{\bf David Kotz} \\[0.4cm]
29+
Principal author of this tutorial for gnuplot 3.0, July 3, 1991 \\[1.0cm]
30+
31+
{\bf current gnuplot team} \\[0.4cm]
32+
Updates of this tutorial for gnuplot 4.0, March 2004
33+
34+
\vskip2cm
35+
36+
Consequently, this document describes gnuplot version 3.0 and later.
37+
38+
% All plots in this document were made with the version of gnuplot.
39+
40+
\end{center}
41+
42+
\vfil
43+
\vfil
44+
\tableofcontents
45+
\vfil
46+
47+
\end{titlepage}
48+
2249

2350
\pagestyle{myheadings}
24-
\markright{GNUPLOT \LaTeX\ Tutorial Version 3.0}
51+
\markright{Gnuplot \LaTeX\ Tutorial Version 3.0}
2552

2653
\currentspace % defined in header.tex
2754

2855
\section{Introduction and History}
2956

30-
GNUPLOT was originally developed by Colin Kelley and Thomas Williams
57+
Gnuplot was originally developed by Colin Kelley and Thomas Williams
3158
in 1986 to plot functions and data files on a variety of terminals.
3259
In 1988 and 1989 I created an alternate version, known as Gnu\TeX,
3360
that supported a new ``terminal type'' called {\tt latex}, so gnuplot
@@ -36,16 +63,16 @@ \section{Introduction and History}
3663
by the {\tt latex} terminal, allowing the user to produce
3764
publication-quality plots.
3865

39-
In late 1989 and early 1990 Gnu\TeX\ and a number of other GNUPLOT
40-
variants were merged together into a new release of GNUPLOT, 2.0. This
66+
In late 1989 and early 1990 Gnu\TeX\ and a number of other gnuplot
67+
variants were merged together into a new release of gnuplot, 2.0. This
4168
includes, among many other improvements, a \LaTeX\ driver derived from
4269
the one in Gnu\TeX. Former Gnu\TeX\ users are referred to
43-
Section~\ref{oldusers} for information about adapting to GNUPLOT.
44-
Anyone interested in using GNUPLOT with \LaTeX\ should read the next
45-
section, a tutorial, and the primary GNUPLOT manual.
70+
Section~\ref{oldusers} for information about adapting to gnuplot.
71+
Anyone interested in using gnuplot with \LaTeX\ should read the next
72+
section, a tutorial, and the primary gnuplot manual.
4673

4774
The reader should note that the \LaTeX\ picture environments output by
48-
GNUPLOT can be quite large and complicated, and can easily exceed the
75+
gnuplot can be quite large and complicated, and can easily exceed the
4976
memory capacity of \TeX. If an enlarged version of \TeX\ is available,
5077
it is wise to use it. Otherwise, keep your plots simple and add
5178
\verb+\clearpage+ to your document where necessary.
@@ -56,46 +83,47 @@ \section{Introduction and History}
5683
memory. See Section~\ref{s:eepic} for more information.
5784

5885
There is a small package of auxiliary files (makefiles and scripts)
59-
that I find useful for making \LaTeX\ plots with GNUPLOT. This is
86+
that I find useful for making \LaTeX\ plots with gnuplot. This is
6087
available for \verb+ftp+ as \verb+pub/gnuplot-latex.shar+ from
6188
\verb+cs.duke.edu+. I can mail copies (see the end of this paper for
6289
information).
6390

64-
\section{Using GNUPLOT for \LaTeX: a Tutorial}
91+
\section{Using gnuplot for \LaTeX: a Tutorial}
6592

66-
GNUPLOT is by nature an interactive program. Users making plots for
67-
\LaTeX\ will generally not use GNUPLOT interactively. Whenever hard
68-
copy is desired from GNUPLOT, the program need not be run on a
93+
Gnuplot is by nature an interactive program. Users making plots for
94+
\LaTeX\ will generally not use gnuplot interactively. Whenever hard
95+
copy is desired from gnuplot, the program need not be run on a
6996
graphics terminal. In this case the output is directed to a file or
7097
pipe, then sent to the appropriate output device. For example, output
7198
from the terminal type {\tt unixplot} may be sent to a program
7299
interpreting the Unix plotting standard. The terminal types {\tt
73100
imagen} and {\tt postscript} may be used for output to printers
74101
understanding those languages. (A shell script ({\tt lasergnu}) is
75-
supplied with the distribution that will accept a GNUPLOT command or
102+
supplied with the distribution that will accept a gnuplot command or
76103
input file and send the output to an Imagen or Postscript laser
77104
printer. This script may have been adapted to your site.) The terminal
78105
type {\tt fig} outputs FIG code that can be read by the Fig graphics
79106
program and translated into forms usable in both \TeX\ and
80107
\LaTeX\ documents.
81108

82-
We now ignore the interactive nature of GNUPLOT and provide the input
83-
to GNUPLOT from a file, \ie,
109+
We now ignore the interactive nature of gnuplot and provide the input
110+
to gnuplot from a file, \ie,
84111
\begin{verbatim}
85-
gnuplot gnu.input
112+
gnuplot plotcommands.gp
86113
\end{verbatim}
87-
In this example, all of the commands to GNUPLOT are contained in the
88-
file {\tt gnu.input}. Multiple filenames may be supplied to GNUPLOT
114+
In this example, all of the commands to gnuplot are contained in the
115+
file {\tt plotcommands.gp}. Multiple filenames may be supplied to gnuplot
89116
this way, read in the order they are given. The output (one or more
90117
plots) may be piped to another program or redirected to a file.
91118
Usually, however, we direct the output explicitly with an instruction
92-
to GNUPLOT (the {\tt set output} command). GNUPLOT continues to print
93-
error messages to the terminal (stderr).
119+
to gnuplot (the {\tt set output "outfile.tex"} command). Gnuplot continues to
120+
print error messages to the terminal (stderr). After printing, the output file
121+
has to be closed by {\tt set output}, \ie{} without the file name specification.
94122

95123
\paragraph{Example 1:} Here is a first example, producing a plot for
96-
this document. The GNUPLOT input file is given below, and the output
124+
this document. The gnuplot input file is given below, and the output
97125
appears as Figure~\ref{eg1}. The input file defines the output to be
98-
in \LaTeX, gives a file name for the output, and plots $y=sin(x)$ for
126+
in \LaTeX, gives a file name for the output, and plots $y=\sin(x)$ for
99127
$x$ on $[-\pi,\pi]$. To produce the figure, I simply
100128
\verb+\input{eg1}+ in a {\tt center} environment in a {\tt figure}
101129
environment. In following examples, I will enclose the figure in a box
@@ -113,14 +141,16 @@ \section{Using GNUPLOT for \LaTeX: a Tutorial}
113141
\begin{center}
114142
\input{eg1}
115143
\end{center}
116-
\caption{A first example: $y=sin(x)$}
144+
\caption{A first example: $y=\sin(x)$.}
117145
\label{eg1}
118146
\end{figure}
119147

120-
Note that GNUPLOT has drawn in the axes, labeled the tic marks for us,
148+
Note that gnuplot has drawn in the axes, labeled the tic marks for us,
121149
scaled the $y$ axis automatically, and added a key in the
122150
upper-right-hand corner (this may be moved with the {\tt set key}
123-
command, and removed with {\tt set nokey}).
151+
command, and removed with {\tt unset key}%
152+
\footnote{In gnuplot version 4.0, the syntax {\tt set noXXX} changed to
153+
{\tt unset XXX}.}).
124154

125155
This is the default line style for the \LaTeX\ driver. Because of the
126156
limited picture capabilities of \LaTeX, many dots are required to
@@ -138,7 +168,7 @@ \section{Using GNUPLOT for \LaTeX: a Tutorial}
138168
set output "eg2.tex"
139169
set size 5/5., 4/3.
140170
set format xy "$%g$"
141-
set title "This is a plot of $y=sin(x)$"
171+
set title "This is a plot of $y=\\sin(x)$"
142172
set xlabel "This is the $x$ axis"
143173
set ylabel "This is\\the\\$y$ axis"
144174
plot [0:6.28] [0:1] sin(x)
@@ -172,7 +202,7 @@ \section{Using GNUPLOT for \LaTeX: a Tutorial}
172202
three commands. Note that they are processed by \LaTeX\ and so may
173203
have math mode and other symbols in them. The ylabel may have multiple
174204
lines, delineated with \verb+\\+. The ylabel can be moved around with
175-
optional offset parameters (see {\tt set ylabel} in the GNUPLOT
205+
optional offset parameters (see {\tt set ylabel} in the gnuplot
176206
manual). Typically, the ylabel needs to be moved to the left to avoid
177207
interfering with the left-hand side of the plot. Once these labels
178208
are set up, they will be used for all subsequent plot commands until
@@ -182,7 +212,7 @@ \section{Using GNUPLOT for \LaTeX: a Tutorial}
182212
$[0,2\pi]$) and $y$ (here $[0,1]$).
183213

184214
So far we have plotted one curve, $y=\sin(x)$, on one plot. In
185-
GNUPLOT, each {\tt plot} command generates a new plot. If the output
215+
gnuplot, each {\tt plot} command generates a new plot. If the output
186216
is to a screen, the screen is cleared. If to a printer, a new page is
187217
produced. In the {\tt latex} case, a new picture is started. It is not
188218
likely that \LaTeX\ users will want this to happen, so generally each
@@ -237,7 +267,7 @@ \section{Using GNUPLOT for \LaTeX: a Tutorial}
237267
plot (in this example the dots have different spacing). The
238268
style {\tt impulses} draws a perpendicular from each point to the
239269
$x$-axis. Finally, the {\tt errorbars} style can draw error bars at
240-
each data point (see the GNUPLOT manual).
270+
each data point (see the gnuplot manual).
241271

242272
\paragraph{Example 4:} In the above plots of $\sin(x)$, it would make
243273
more sense to label the axis in units of $\pi$. The position and
@@ -254,7 +284,7 @@ \section{Using GNUPLOT for \LaTeX: a Tutorial}
254284
set title "This is $\sin(x)$"
255285
set xlabel "This is the $x$ axis"
256286
set ylabel "$\sin(x)$"
257-
set nokey
287+
unset key
258288
set xtics -pi, pi/4
259289
plot [-pi:pi] [-1:1] sin(x)
260290
\end{verbatim}
@@ -268,7 +298,7 @@ \section{Using GNUPLOT for \LaTeX: a Tutorial}
268298
\label{eg4}
269299
}
270300

271-
Since {\tt pi} is a predefined variable in GNUPLOT, we can use it
301+
Since {\tt pi} is a predefined variable in gnuplot, we can use it
272302
anywhere we may use an expression. The {\tt set xtics} command here
273303
specifies that the tics on the $x$ axis start at $-\pi$ and increment
274304
by $\pi/4$. Since no end point is given, the tics continue to the
@@ -303,8 +333,8 @@ \section{Using GNUPLOT for \LaTeX: a Tutorial}
303333
\paragraph{Going further:} You should now be able to make a variety of
304334
plots for your \LaTeX\ document. We will present a final example
305335
without explanation that showcases some of the capabilities of
306-
GNUPLOT. You may find documentation for the various commands in the
307-
GNUPLOT manual, though hopefully this example is somewhat
336+
gnuplot. You may find documentation for the various commands in the
337+
gnuplot manual, though hopefully this example is somewhat
308338
self-explanatory. This is shown in Figure~\ref{eg6}.
309339

310340
\singlespace
@@ -346,12 +376,12 @@ \section{Using GNUPLOT for \LaTeX: a Tutorial}
346376
}
347377

348378
\subsection{Summary --- Use with \LaTeX}
349-
In summary, to use the \LaTeX\ facilities of GNUPLOT, the first
350-
command to GNUPLOT should be
379+
In summary, to use the \LaTeX\ facilities of gnuplot, the first
380+
command to gnuplot should be
351381
\begin{syntax}
352382
set terminal latex
353383
\end{syntax}
354-
and the output of GNUPLOT should be directed to a file, for example,
384+
and the output of gnuplot should be directed to a file, for example,
355385
\begin{verbatim}
356386
set output "plot.tex"
357387
\end{verbatim}
@@ -361,12 +391,19 @@ \subsection{Summary --- Use with \LaTeX}
361391
\begin{verbatim}
362392
set size 1,2
363393
\end{verbatim}
364-
tells GNUPLOT to use a 5 inch wide by 6 inch high box for the plot.
394+
tells gnuplot to use a 5 inch wide by 6 inch high box for the plot.
365395
The numbers given are {\em scale factors}, not the actual size. The
366396
default is 5 inches by 3 inches. This is the size of the complete
367397
plot, including all labels.
368398

369-
When finished, the file will contain all of the plots you have
399+
Then you do the (s)plot, and finally issue commands to close the file and
400+
switch the terminal back to the default by
401+
\begin{verbatim}
402+
set output
403+
set terminal pop
404+
\end{verbatim}
405+
406+
Finally, the file will contain all of the plots you have
370407
specified (you probably only want one plot per file). This file can
371408
then be used in a \LaTeX\ document, \eg,
372409

@@ -384,7 +421,7 @@ \subsection{Summary --- Use with \LaTeX}
384421
You will also want to read about the following commands: {\tt set
385422
title, set xlabel, set ylabel, set key, set label, set xtics, set
386423
ytics}, and {\tt set clip}. These are all described in the regular
387-
GNUPLOT manual.
424+
gnuplot manual.
388425

389426
\section{Use with EEPIC}
390427
\label{s:eepic}
@@ -397,8 +434,8 @@ \section{Use with EEPIC}
397434
same. If you change the source, you can generate some more interesting
398435
line styles.
399436

400-
To use EEPIC, set GNUPLOT's terminal type to {\tt eepic} instead of
401-
{\tt latex}, and use GNUPLOT as before. The line styles will change.
437+
To use EEPIC, set gnuplot's terminal type to {\tt eepic} instead of
438+
{\tt latex}, and use gnuplot as before. The line styles will change.
402439
Include the file {\tt plot.tex} in your document as before, along with
403440
the document style options {\tt [epic,eepic]}.
404441

@@ -407,18 +444,49 @@ \section{For Former Gnu\TeX\ Users}
407444

408445
Former Gnu\TeX\ users may be pleased with many of the new features
409446
(many inspired by your suggestions!), but will also find many changes.
410-
GNUPLOT will {\em not\/} run all Gnu\TeX\ input files unchanged.
411-
Several Gnu\TeX\ features were not included in GNUPLOT because they
447+
gnuplot will \emph{not} run all Gnu\TeX\ input files unchanged.
448+
Several Gnu\TeX\ features were not included in gnuplot because they
412449
were specific to the \LaTeX\ driver. I encourage you to use the newer
413-
GNUPLOT. A translator is available that attempts to translate your
414-
old Gnu\TeX\ 1.6 input files into GNUPLOT 3.0 files. You can ftp it
450+
gnuplot. A translator is available that attempts to translate your
451+
old Gnu\TeX\ 1.6 input files into gnuplot 3.0 files. You can ftp it
415452
from \verb+cs.duke.edu+ as \verb+dist/sources/gnuplot/gnut2p.tar.Z+.
416453
This file also contains directions and a list of changes from Gnu\TeX\
417-
to GNUPLOT.
454+
to gnuplot.
455+
456+
457+
\section{What is new for \TeX{} and \LaTeX{} terminals in gnuplot 4.0}
458+
459+
In addition to the \texttt{latex} terminal, the following \LaTeX-friendly
460+
terminals are available:
461+
462+
\begin{itemize}
463+
\item \texttt{emtex}: Like the \texttt{latex} terminal, but supports emtex
464+
specials: any line slopes contrary to a very limited set of \LaTeX{} slopes.
465+
466+
\item \texttt{epslatex}: Combined \LaTeX{} and postscript parts for text and
467+
lines, respectively, with the postscript part included by
468+
\verb+\includegraphics{...}+ command.
469+
470+
\item \texttt{pstex} and \texttt{pslatex}: Combined \TeX{} / \LaTeX{} and
471+
postscript parts for text and lines, respectively, included by
472+
\verb+\special{psfile=...}+ command.
473+
474+
\item \texttt{mf} and \texttt{mp}: Produces metafont and metapost outputs.
475+
476+
\end{itemize}
477+
478+
See helps of these terminals for more details about their usage.
479+
480+
In addition, the \texttt{postscript eps enhanced} is the most useful for \TeX{}
481+
and \LaTeX{} if you don't insist of using \TeX{} fonts for the graph labels, and
482+
\texttt{pdf enhanced} and \texttt{png enhanced} for pdf\LaTeX{}.
483+
484+
485+
\section{Contact for help}
418486

419-
\section{Contact}
420-
For general GNUPLOT questions, send mail to the GNUPLOT mailing list
421-
(\verb+info-gnuplot@dartmouth.edu+) or post to the GNUPLOT newsgroup
422-
(\verb+comp.graphics.apps.gnuplot+).
487+
For general gnuplot questions, the gnuplot mailing list
488+
\url{info-gnuplot@lists.sourceforge.net} is where you can send your e-mail, or
489+
you can use gnuplot newsgroup \url{comp.graphics.apps.gnuplot}. Addional sources
490+
of information are available on gnuplot homepage \url{www.gnuplot.info}.
423491

424492
\end{document}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL