summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pst-plot/tugboat01-4.tex
blob: bc6a4f7a9c4e645bcfcbf21bce80756aa0ce515c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
%\documentclass[final,harvardcite]{ltugboat}
\documentclass[final]{ltugboat}
\PrelimDraftfalse
\InputIfFileExists{tugboat.dates}%
  {}{}
\InputIfFileExists{tb72pages.tex}%
  {}{\def\TBpstplot{1001}}
\setcounter{page}{\TBpstplot}

\overfullrule=6pt

\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[scaled=0.96]{helvet}
\usepackage{mathptmx}
\usepackage{courier}
\usepackage{comment}
\usepackage{tabularx}

\usepackage{graphicx}
%\usepackage{pstcol}
%\usepackage{pst-plot}%
%
\newcommand\verbI[1]{{\small\texttt{#1}}}
\newcommand\CMD[1]{{\small\textbackslash\texttt{#1}}}
\setlength{\belowcaptionskip}{\abovecaptionskip}
%
\usepackage{listings}
\lstset{language=[LaTeX]TEX,basicstyle=\ttfamily\footnotesize,%
        extendedchars=true,numbers=left,numberstyle=\tiny,%
        xleftmargin=2em,breaklines=true}
%
\usepackage{ifpdf}
\ifpdf%
        \usepackage[%
                pdftex,%
                pdfauthor={Jana and Herbert Voss},%
                pdftitle={2D Plots},%
                linktocpage,%
                colorlinks]{hyperref}
\hypersetup{%
colorlinks,linkcolor={black}, citecolor={black}, pagecolor={black}, 
urlcolor={black}
}

\else
        \usepackage[%
                ps2pdf,%
                pdfauthor={Jana and Herbert Voss},%
                pdftitle={2D Plots},%
                linktocpage,%
                colorlinks]{hyperref}
\fi
\makeatletter
\usepackage{url}

\begin{document}

\sectitle{Graphics}


\title{The plot functions of \texttt{pst-plot}\thanks{Translated from
``Die Plot-Funktionen von pst-plot,'' 
\textsl{Die TeXnische Kom\"odie} \textbf{2/02}, June 2002, pages 27-34,
with permission.}}

\author{Jana Voß}
\address{Wasgenstr. 21\\14129 Berlin \textsc{GERMANY}}
\netaddress{Jana@perce.de}
%
\author{Herbert Voß}
\address{Wasgenstr. 21\\14129 Berlin \textsc{GERMANY}}
\personalURL{http://www.perce.de}
\netaddress{voss@perce.de}

\maketitle

\begin{abstract}
  Plotting of external data records is one of the standard problems of
  technical and industrial publications. One common approach is
  importing the data files into an external program, such as
  \verbI{gnuplot}, provided with axes of coordinates and further
  references, and finally exported to \LaTeX. By contrast, in this
  article we explain ways to get proper data plotting without using
  external applications.
\end{abstract}

\section{Introduction}

The history and the meaning of \PS{} have been covered sufficiently in
many articles. For the programming language \PS{} have a look at
\cite{PostScript,ThinkPostScript}.  The package \verbI{pst-plot}
\cite{pst-plot} under consideration here is part of the \verbI{pstricks}
project. It must be loaded into a \LaTeX{} document as usual with 
\CMD{usepackage\{pst-plot\}} or alternatively, for documents written in Plain\TeX,
with \CMD{input pst-plot.tex}.

\verbI{pst-plot} provides three plot macros for the representation of
external data, with the following syntax:

{\small\begin{verbatim}
\listplot*[<parameter>]{<data macro>}
\dataplot*[<parameter>]{<data macro>}
\fileplot*[<parameter>]{<file name>}
\end{verbatim}}
    
    The starred forms have the same meaning as with all macros of
    \verbI{pstricks}: to plot the data in a reversed mode.  Thus, for a
    default black-on-white diagram one produces the negative with the
    starred command form, namely white-on-black. Additionally, a negative plot
    implies that \PS{} closes the path of the points from the last to
    the first one and fills all points inside this closed path with the
    actual fillcolor. For our purposes in this article there will be no
    real sense in this negative view; therefore, all of the following
    examples are plotted with the normal (unstarred) form only.

For further information about the package \verbI{pstricks} have a look at the (more
or less) official documentation \cite{pstricks}, or the extensive
description in the ``standard \LaTeX'' book \cite{companion} or in
\cite{girou:01:,girou:02:}. Altogether, however, these do not fully
describe the substantial differences between these three plot macros.

For all of the examples in this article, the complete \verbI{pspicture}
environment is indicated, so that the examples may be directly copied.
The Documentation of the \verbI{multido} macro used here can be found in the
package itself \cite{multido}; macros not otherwise mentioned are
described in the \verbI{pstricks} documentation \cite{pstricks}.

The general \verbI{plotstyle} parameter is particularly important, and
can take the values shown in table \ref{tab:options}.

\begin{table}
\caption{Possible options}\label{tab:options}
\begin{tabularx}{1.0\linewidth}{r|X}
style option& meaning\\
\hline
\verbI{plotstyle=dots} & plot $(x,y)$ as a dot\\
\verbI{=line} & draw a line from a dot to the following one\\
\verbI{=polygon} & nearly the same as \verbI{line}, but with a line from the last to the first dot\\
\verbI{=curve} & interpolation between three dots, whereby the curve can go beyond the point of origin and/or termination point\\
\verbI{=ecurve} & like \verbI{curve}, but ends at the first/last dot\\
\verbI{=ccurve} & like \verbI{curve}, but closed\\
\end{tabularx}
\end{table}

By default, the \verbI{line} option is selected.

The following general commands are also useful in conjunction with the
plot commands. They are also defined by the \verbI{pst-plot} package:

{\small\begin{verbatim}
\readdata{<data macro name>}{<file name>}
\savedata{<data macro name>}{<file name>}
\end{verbatim}}
    
    In the following examples only the \CMD{readdata} macro is used,
    but it would be straightforward to create examples with
    \CMD{savedata}.

\section{Examples for \CMD{listplot}}

The syntax of \CMD{listplot} is :

{\small\begin{verbatim}
\listplot{<data macro name>}
\end{verbatim}}
    
    The data macro may contain any additional \AllTeX- or
    \PS-commands. The \AllTeX{} macros are expanded first before they
    are passed as a \textbf{list} of $x|y$ values to \PS. The data
    records can be defined inside the document like

{\small\begin{verbatim}
\newcommand{\dataA}{
 1.00000000  1.00000000
 0.56000000  0.31000000
 0.85841600  0.17360000
 ...
\end{verbatim}}

\noindent or can be read from an external data file with the \CMD{readdata} macro:
 
{\small\begin{verbatim} \readdata{\dataA}{/anyPath/data.dat}
\end{verbatim}}
    
    The example in figure \ref{fig:listplot1} shows the Henon
    attractor, a typical graphic of a system with chaotic
    behavior\cite{voss:chaos}.
    
    Figure \ref{fig:listplot2} is nearly the same as
    figure~\ref{fig:listplot1}, with the addition of \PS{} code to
    get
    the "Draft" watermark. (Some familiarity with \PS{} is needed to
    fully understand its operation.) To save space, listing
    \ref{lst:listplot2} does not contain the data, which is nothing
    more than a sequence of pairs of floats, each value separated by a
    space, as shown above.

\begin{figure}[htb]
\centering
\begin{comment}
\PSforPDF{%
\readdata{\henon}{henon.dat}
\psset{xunit=1.5cm, yunit=3cm}
\begin{pspicture}(-2,-0.5)(2.25,1.25)
  \psaxes{->}(0,0)(-2,-0.5)(1.5,1.25)
  \listplot[%
    showpoints=true,%
    plotstyle=curve]{\henon}
\end{pspicture}%
}
\end{comment}
\includegraphics{fig4}
\caption{Example for \CMD{listplot}}\label{fig:listplot1}
\end{figure}

\begin{figure}[htb]
\centering
\begin{comment}
\newcommand{\dataA}{
 1.00000000  1.00000000
 0.56000000  0.31000000
 0.85841600  0.17360000
 0.11249564  0.26610896
 1.24788537  0.03487365
-1.20752013  0.38684447
-0.71282656 -0.37433124
-0.10602649 -0.22097623
 0.76283584 -0.03286821
 0.12916912  0.23647911
 1.21245320  0.04004243
-1.07681914  0.37586049
-0.29387634 -0.33381393
 0.54182291 -0.09110166
 0.48615456  0.16796510
 0.82762650  0.15070791
 0.16435741  0.25656422
 1.21766498  0.05095080
-1.08414872  0.37747614
-0.31506881 -0.33608610
 0.52096746 -0.09767133
 0.51150245  0.16149991
 0.78474587  0.15856576
 0.27177620  0.24327122
 1.13690951  0.08425062
-0.77704042  0.35244195
 0.48298173 -0.24088253
 0.42320673  0.14972434
 0.89181467  0.13119409
-0.01408602  0.27646255
 1.27617683 -0.00436667
-1.34958997  0.39561482
-1.22719125 -0.41837289
-1.58701052 -0.38042929
  gsave
  /Helvetica findfont 40 scalefont setfont
  45 rotate
  0.9 setgray
  -60 10 moveto (DRAFT) show
  grestore
}
\psset{xunit=1.5cm, yunit=3cm}
\begin{pspicture}(-2,-0.5)(2.25,1.25)
  \psaxes{->}(0,0)(-2,-0.5)(1.5,1.25)
  \listplot[%
    showpoints=true,%
    linecolor=red,%
    plotstyle=curve]{\dataA}
\end{pspicture}%
\end{comment}
\includegraphics{fig5}
\caption{Example for modified \CMD{listplot}}\label{fig:listplot2}
\end{figure}


\begin{lstlisting}[caption={\LaTeX\ source for figure \ref{fig:listplot1}},%
        label={lst:listplot1}]
\readdata{\henon}{henon.dat}
\psset{xunit=1.5cm, yunit=3cm}
\begin{pspicture}(-3,-0.5)(2.25,1.25)
  \psaxes{->}(0,0)(-2,-0.5)(1.5,1.25)
  \listplot[%
    showpoints=true,%
    linecolor=red,%
    plotstyle=curve]{\dataA}
\end{pspicture}
\end{lstlisting}


\begin{lstlisting}[caption={\LaTeX\ source for figure \ref{fig:listplot2}},%
        label={lst:listplot2}]
\newcommand{\DataA}{%
  [ ... data ... ]
  gsave          % save graphic status
  /Helvetica findfont 40 scalefont setfont
  45 rotate      % rotate by 45 degrees
  0.9 setgray    % 1 is color white
  -60 10 moveto (DRAFT) show
  grestore
}
\psset{xunit=1.5cm, yunit=3cm}
\begin{pspicture}(-3,-0.5)(2.25,1.25)
  \psaxes{->}(0,0)(-2,-0.5)(1.5,1.25)
  \listplot[%
    showpoints=true,%
    plotstyle=curve]{\dataA}
\end{pspicture}
\end{lstlisting}


Naturally, \verbI{[... data ...]} is replaced by all
the $x|y$-values; they're omitted here only to save space.

As an alternative to direct modification of the data set passed to 
\CMD{listplot}, one can redefine the macro \verbI{defScalePoints} from
\verbI{pst-plot}. For example, to change the $x|y$ values and then
rotate the whole plotted graphic (don't ask why!), the redefinition is
as shown in listing \ref{lst:listplot3}.

\begin{lstlisting}[%
        caption={\LaTeX\ source for figure \ref{fig:listplot3}},%
        label={lst:listplot3}]
\makeatletter
\pst@def{ScalePoints}<%
%-------------------------------------
  45 rotate % rotate the whole object
%-------------------------------------
  /y ED /x ED
  counttomark dup dup cvi eq not { exch pop } if
  /m exch def /n m 2 div cvi def
  n {
%-------------------------------------
     exch % exchange the last two elements
%-------------------------------------
     y mul m 1 roll
     x mul m 1 roll
     /m m 2 sub
     def } repeat>
\makeatother
\end{lstlisting}

\noindent This gives figure \ref{fig:listplot3}.



\begin{figure}[htb]
\centering
\begin{comment}
\makeatletter
\pst@def{ScalePoints}<%
%-----------------------------------------------
  45 rotate % rotate the whole object
%-----------------------------------------------
  /y ED /x ED
  counttomark dup dup cvi eq not { exch pop } if
  /m exch def /n m 2 div cvi def
  n {
%-----------------------------------------------
     exch % exchange the last two elements
%-----------------------------------------------
     y mul m 1 roll
     x mul m 1 roll
     /m m 2 sub
     def } repeat>
\makeatother
\readdata{\henon}{henon.dat}
\begin{pspicture}(-0.5,-2.75)(3,3)
\psset{xunit=3cm, yunit=1.5cm}
  \psaxes{->}(0,0)(-0.5,-2)(1.25,2)
  \listplot[%
    showpoints=true,%
    plotstyle=curve]{\henon}
\end{pspicture}%
\end{comment}
\includegraphics{fig6}
\caption{Example for \CMD{listplot} with a redefined \verbI{ScalePoints}}\label{fig:listplot3}
\end{figure}

Thus, the advantage of \CMD{listplot} is that one can easily modify the
data values without any external program. Here is one more example---suppose
you have the following data records:

{\small\begin{verbatim}
1050, 0.368
1100, 0.371
1200, 0.471 
1250, 0.428    
1300, 0.391    
1350, 0.456    
1400, 0.499    
1500, 1.712    
1550, 0.475    
1600, 0.497
\end{verbatim}}

\noindent which perhaps came automatically from a technical device. The
unit of the x-values is micrometer but it makes more sense to use
millimeter for the plot. A redefinition of \verbI{ScalePoints} makes it
very easy to plot the data with this change of scale:

\begin{lstlisting}[caption={Rescale all x values},label={lst:lstplot}]
  \makeatletter
\pst@def{ScalePoints}<%
  /y ED /x ED
  counttomark dup dup cvi eq not { exch pop } if
  /m exch def /n m 2 div cvi def
  n {
     y mul m 1 roll
     x mul 1000 div m 1 roll% <-- divide by 1000
     /m m 2 sub
     def } repeat>
\makeatother
\end{lstlisting}

\begin{figure}[htb]
\centering
\begin{comment}
\makeatletter
\begin{pdfpic}
\pst@def{ScalePoints}<%
  /y ED /x ED
  counttomark dup dup cvi eq not { exch pop } if
  /m exch def /n m 2 div cvi def
  n {
     y mul m 1 roll
     x mul 1000 div m 1 roll% <-- divide by 1000
     /m m 2 sub
     def } repeat>
\makeatother
\def\dataA{%
1050 0.368
1100 0.371
1200 0.471 
1250 0.428    
1300 0.391    
1350 0.456    
1400 0.499    
1500 1.712    
1550 0.475    
1600 0.497 }%
\psset{xunit=5}
\begin{pspicture}(1,-0.25)(2,2.25)
        \psaxes[Dx=0.25,Ox=1]{->}(1,0)(2,2)
        \psaxes[Dx=0.05,Ox=1,labels=none,ticksize=0.05](1,0)(2,0)
        \listplot[plotstyle=dots,linecolor=red]{\dataA}
\end{pspicture}%
\end{pdfpic}
\end{comment}
\includegraphics{fig7}
\caption{Example for modified data values with a redefined \verbI{ScalePoints}} \label{fig:lstplot4}
\end{figure}



\section{Examples for \CMD{dataplot}}

\CMD{dataplot} has the same syntax as \CMD{listplot}, so the first
question is, what is the difference between the two? \CMD{listplot}
builds a list of all the data and then multiplies all values with the
length unit.  This takes some time, so you may prefer a so-called
``quick plot'', where the data can be passed more quickly to \PS,
depending on the plotstyle and especially the option \verbI{showpoints}.
Table \ref{tab:quickplot} shows whether this is possible. A quick plot
is not possible with \CMD{listplot}, whereas \CMD{dataplot} uses it
whenever possible.  When it is not possible, \CMD{dataplot} simply calls
\CMD{listplot}.


\def\hI{\hangindent=3em}
\begin{table}[htb]
\caption{Possible options for a ''quick plot``}\label{tab:quickplot}
\begin{tabularx}{\columnwidth}{lX|l}
plotstyle & options & macro\\\hline
\verbI{line} & all, except & quick plot\\
        & \verbI{linearc}, \verbI{showpoints}, \verbI{arrows},  & \CMD{listplot}\\
\verbI{polygon} & all, except & quick plot\\
        & \verbI{linearc}, \verbI{showpoints}  & \CMD{listplot}\\
\verbI{dots} & all & quick plot\\
\verbI{bezier} & all, except & quick plot\\
        &\verbI{arrows}, \verbI{showpoints} & \CMD{listplot}\\
\hI\verbI{cbezier} & all, except& \CMD{listplot}\\
        &\verbI{showpoints} & quick plot\\
\verbI{curve} & all & \CMD{listplot}\\
\verbI{ecurve} & all & \CMD{listplot}\\
\verbI{ccurve} & all & \CMD{listplot}
\end{tabularx}
\end{table}


\CMD{dataplot} needs to be passed a macro holding the data.  The data is
typically saved in an external file, which can be read by (for instance)
the \CMD{readdata} macro, as follows:

{\small\begin{verbatim}
\readdata{<object name>}{<data file>}
\end{verbatim}}

\noindent For example: 

{\small\begin{verbatim}
\readdata{\feigenbaum}{feigenbaum.data}
\end{verbatim}}
    
The amount of data is limited only by \TeX's memory. The above example
can be plotted with:

{\small\begin{verbatim}
\dataplot{\feigenbaum}
\end{verbatim}}
    
    Overlays with different data files are also possible.  For example,
    figure~\ref{fig:dataplot} shows the use of two different data files
    which are plotted using one coordinate system. It shows the sorting
    time for ``Bubble-Sort'' and ``Select-Sort{}'' as a function of the
    number of the elements.

\begin{figure}
\centering
\begin{comment}%
\psset{xunit=0.0005cm,yunit=0.005cm}
\begin{pspicture}(0,-50)(10000,1100)
  \readdata{\bubble}{bubble.data}
  \readdata{\select}{select.data}
  \dataplot[%
        plotstyle=line,%
        linecolor=blue]{\bubble}
  \dataplot[%
        plotstyle=line,%
        linecolor=red,%
        linewidth=2pt]{\select}
  \psline{->}(0,0)(10000,0)
  \psline{->}(0,0)(0,1000)
  \rput[l](40,920){time}
  \rput[r](9990,-30){elements}
  \rput[l](4500,800){Bubble-Sort}
  \rput[l](7500,200){Select-Sort}
\end{pspicture}%
\end{comment}
\includegraphics{fig0}
\caption{Example for \CMD{dataplot}}\label{fig:dataplot}
\end{figure}

\begin{lstlisting}[caption={\LaTeX\ source for figure \ref{fig:dataplot}}]
\psset{xunit=0.0005cm,yunit=0.005cm}
\begin{pspicture}(0,-50)(10000,1100)
  \readdata{\bubble}{bubble.data}
  \readdata{\select}{select.data}
  \dataplot[%
        plotstyle=line,%
        linecolor=blue]{\bubble}
  \dataplot[%
        plotstyle=line,%
        linecolor=red,%
        linewidth=2pt]{\select}
  \psline{->}(0,0)(10000,0)
  \psline{->}(0,0)(0,1000)
  \rput[l](20,995){time}
  \rput[r](9990,-20){elements}
  \rput[l](4500,800){Bubble-Sort}
  \rput[l](7500,200){Select-Sort}
\end{pspicture}
\end{lstlisting}

In summary, the advantage of \CMD{dataplot} is the possibility of a
''quick plot``, and the advantage of \CMD{listplot} is that it is easy
to manipulate the data values before they are plotted.


\section{Examples for \CMD{fileplot}}

\CMD{fileplot} can be used whenever $(x|y)$ data that is saved in a file
is to be plotted.  The values must be given as pure numerical values in
pairs, one pair on each line, and may have spaces, commas, parentheses,
and braces as punctuation, as follows:

\begin{verbatim}
x y
x,y
(x,y)
{x,y}
\end{verbatim}

The tab character (\CMD{t} or \acro{ASCII} \CMD{009}) is often used as a
separator, but tab is \emph{not} valid here. Tabs may be converted to
spaces in many ways, for example with the standard Unix utility
\texttt{tr}:

{\small\begin{verbatim}
tr '\t' ' ' <inFile >outFile
\end{verbatim}}
    
The data files may also contain \% characters, but no other characters
are allowed.
 
Our first example for \CMD{fileplot} is shown in
figure~\ref{fig:fileplot1}, which is an \acro{UV/VIS} absorber spectrum
$A=\lg \frac{I_{0}}{I}$ as a function of the wavelength. The second
example (figure~\ref{fig:fileplot2}) shows the evolution of a population
as a function of the spawn factor (Feigenbaum diagram
\cite{voss:chaos}). The source code for these images is shown in
listings~\ref{lst:fileplot1} and~\ref{lst:fileplot2}.

\begin{figure}[htb]
\centering
\begin{comment}%
\psset{xunit=0.0025cm,yunit=1.1cm}
\begin{pspicture}(-25,-.25)(1950,4)
  \fileplot[plotstyle=line, linewidth=1.5pt]{fileplot.data}
  \psaxes[dx=400,Dx=400]{->}(1900,4)
  \multido{\n=200+200}{9}{%
    \psline[linestyle=dotted](\n,0)(\n,4)
  }
  \multido{\n=+1}{5}{%
    \psline[linestyle=dotted](0,\n)(1800,\n)%
  }
\end{pspicture}%
\end{comment}
\includegraphics{fig1}
\caption{Example for \CMD{fileplot}}\label{fig:fileplot1}
\end{figure}

\begin{lstlisting}[caption={\LaTeX\ source for figure \ref{fig:fileplot1}},label={lst:fileplot1}]
\psset{xunit=0.0025cm,yunit=1.1cm}
\begin{pspicture}(-25,-.25)(1950,4)
  \fileplot[plotstyle=line]{fileplot.data}
  \psaxes[dx=400,Dx=400]{->}(1900,4)
  \multido{\n=200+200}{9}{%
    \psline[linestyle=dotted](\n,0)(\n,4)%
  }
  \multido{\n=+1}{5}{%
    \psline[linestyle=dotted]%
       (0,\n)(1800,\n)%
  }
\end{pspicture}
\end{lstlisting}


\begin{figure}[htb]
\centering
\begin{comment}%
\psset{xunit=1.25cm,yunit=5cm}
\begin{pspicture}(-0.25,-0.05)(4.25,1.2)
  \fileplot[plotstyle=dots]{feigenbaum.data}
  \psaxes{->}(0,0)(4.05,1)
  \rput(4,-0.05){$x$}
  \rput(0.2,1.05){$y$}
  \rput[l](0.2,3.75){Feigenbaum-Diagram}
\end{pspicture}%
\end{comment}
\includegraphics{fig2}
\caption{Another example for \CMD{fileplot}}\label{fig:fileplot2}
\end{figure}


\begin{lstlisting}[caption={\LaTeX\ source for figure \ref{fig:fileplot2}},label={lst:fileplot2}]
\psset{xunit=1.5cm,yunit=6cm}
\begin{pspicture}(-0.25,-0.05)(4.25,1)
  \fileplot[plotstyle=dots]{%
     feigenbaum.data}
  \psaxes{->}(0,0)(4.05,1)
\end{pspicture}
\end{lstlisting}

As you may see in listing \ref{lst:fileplot}, \CMD{fileplot} does little
of its own.  It first calls \CMD{readdata} to read the data, and then,
depending on the kind of data and specified options, \CMD{fileplot} uses
\CMD{dataplot} for a quick plot if possible.  Otherwise, it falls back
to \CMD{listplot}.

\begin{lstlisting}[caption={The source of the \CMD{fileplot} macro},label={lst:fileplot}]
\def\fileplot{\def\pst@par{}\pst@object{fileplot}}
\def\fileplot@i#1{%
  \pst@killglue
  \begingroup
    \use@par
    \@pstfalse
    \@nameuse{testqp@\psplotstyle}%
    \if@pst
      \dataplot@ii{\pst@readfile{#1}}%
    \else
      \listplot@ii{\pst@altreadfile{#1}}%
    \fi
  \endgroup
  \ignorespaces%
}
\end{lstlisting}

\CMD{fileplot} has the advantage of being easy to use, but the
disadvantage of needing a lot of memory: \TeX{} has to read the all the
data values before it can process anything. As a rule of thumb, when
there are more than 1000 data entries \TeX{}'s main menory must be
increased. Furthermore, the running time may be enormous, especially on
slow machines.

To prevent such problems, one can use the \CMD{PSTtoEPS} macro to create
an \texttt{eps} file. For more information, see the documentation of
\verbI{pstricks} \cite{pstricks}.

\bibliographystyle{plain}
\bibliography{\jobname}
%\bibliographystyle{ltugbib}

\makesignature

\end{document}