UK Nonlinear News, February 1998

A guide to converting output from the dynamical systems package AUTO into high-quality postscript

Andrew Edwards

(previously University of Leeds)

I used Eusebius Doedel's numerical package AUTO extensively to numerically compute bifurcation diagrams for my Ph.D. thesis. Unfortunately, I found the quality of postscript figures produced by Auto to be slightly inadequate. In particular, the lines were faint and did not reproduce well when figures were shrunk, and the axes labels became too small. Eventually I learnt how to improve the quality of the figures, and how best to incorporate them into LaTeX documents, by hand-editing the postscript files. Since this took a rather long time to figure out, it seems pertinent to make my findings available to others who use AUTO. This article refers to AUTO94 - I have not yet used AUTO 97 .

I obtained a postscript file from AUTO using Plaut and then using the tek2ps convertor. I then edited the text of the postscript file to improve the quality. There may be an alternative WYSIWYG approach, using a point-and-click picture editor, but the method described here ensures that all diagrams are converted in exactly the same way, and makes clear how to add your own refinements. The edits may appear lengthy, but only take a few minutes to make.

Figure 1 shows an original postscript file obtained via Plaut, and Figure 2 shows the bolder version, with larger characters. Unfortunately, to show the figures on a WWW page I had to convert them both into .gif files, and the difference in quality (in particular the boldness of the lines) is not too apparent. To download a postscript file (only 231 kilobytes) that more clearly shows the difference click here.

Figure 1. Original postscript output derived from Plaut. This shows the variation in phytoplankton concentration as the predation on zooplankton, parameter d, is varied for a nutrient-phytoplankton-zooplankton model (consisting of three coupled ordinary differential equations). Solid lines indicate stable steady states, dashed lines indicate unstable steady states, squares represent Hopf bifurcations, and solid circles indicate the maximum and minimum phytoplankton concentrations reached along limit cycles.





Figure 2. Improved-quality postscript file, with bolder lines and larger fonts. The difference in quality is not too clearly seen, since both pictures have been converted into .gif format for this WWW page. Download this postscript file to see the contrast between the figures more clearly. This is Figure 3(b) in Edwards and Brindley (1996).

Firstly, a brief description of how I obtained Figure 1. I used AUTO 94, and created the diagram using the built-in package Plaut. I did not use the Graphical User Interface, since I learnt to use the command mode interface before it was implemented (and for some quirky reason it only seemed to work on our computers on Thursdays).

In Plaut I used the following options (a full list of commands appears in the AUTO97 manual):

dp
indicates stability - solid lines for stable steady states, solid circles for stable limit cycles, etc.
sy
adds symbols - such as squares for Hopf bifurcations.
bd
allows specification of axes ranges, plus the following options (with my choices for the figures shown below given in brackets) - labels (N), grid lines (N), title (N), axes names ("Predation on Z, d", "Phytoplankton").
sav
save as filename.tek.

I then converted filename.tek into a postscript file by typing (in the command tool)

 tek2ps filename.tek > filename.ps

In order to show Figure 1 on a WWW page I had to rotate, translate, and rescale it - this involved removing the relevant parts from the /NP section of the postscript file (see table), and changing .1730769 .17626953 scale to 0.13 0.13 scale, and then cropping and saving as a .gif file using xv.

To obtain the bolder lines and larger font, and to insert into LaTeX, I followed the methodology presented in the following table. You will have to edit the source code of filename.ps. I figured out what to do by playing around with the code, and viewing the diagrams using ghostview. Note that at the given scale, the diagram is too large to fit onto a standard page (A4 or American Letter sizes), but when put into LaTeX the diagram does fit. Just change the numbers preceding scale to make the diagram smaller.




Steps to improve quality of an AUTO postscript file.

Line number or section Change or remove Replace with Comments
3 @(#)pstek.pro 1.10 Remove This may not appear on all versions
9
%%BoundingBox: 40 40 540 540
%%BoundingBox: 35 0 740 540
May want to change numbers if not going to use LaTeX
13
 /FntH .... 80 ....
 /FntH .... 100 ....
Increases font size
/NP
572 40 translate       % leave a border
90 rotate
% .71707 .692308 scale % 0-1023X, 0-780Y
Remove - but don't remove the { bracket Keep translate and change the numbers if not going to use LaTeX
/DP
/DP	% tsizey -> - erase and home
{	clippath 1 setgray fill
0 setgray
0 exch moveto
} def
Remove whole section -
- Find stroke and replace with ST throughout whole document, but not if /ST section already exists before FntH - Use an automatic Find and Replace' command - there are lots of strokes!
Before
FntH  setfont
/ST	% stroke, with wider line
{	4 setlinewidth
1 setlinecap
1 setlinejoin
stroke
} def
- I think that the default is 2 setlinewidth , and so 4 makes the lines twice as thick. If /ST already appears, just change the setlinewidth to 4.
NP Remove
0 3068 moveto
89 DP
- -
NP - 5th and 8th lines 540 .... 550 .... -
After the x-axis name, the y-axis name and x-axis numbers, come the y-axis numbers. For the second and subsequent y-axis numbers, change each 540 in
 540 ... moveto
Change each 540 to 550 to give
 550 ... moveto 
This stops the tick-marks from overlapping with the y-axis numbers (which are larger because of the increased font-size) and may not be needed





In order to ... Simply' ....
Put the (b) in Figure 2 in the top right-hand corner Insert
((b)) 3600 2490 PR
above the moveto preceding the start of the x-axis name.
Put the (b) in the top left-hand corner Insert
((b)) 610 2490 PR
above the moveto preceding the start of the x-axis name.
To annotate the graph with Hello Mum Insert
(Hello Mum) 610 2490 PR
above the moveto preceding the start of the x-axis name, changing the co-ordinates as required.
Avoid some of the x-axis numbers clashing with the x-axis labels, which happens if the numbers are too large to be plotted along one row, and thus get plotted along two rows Change each offending 340 to 400 in the locations of the x-axis numbers
/Symbol findfont 100.00 scalefont setfont
(a) 1880 1900 PR
before showpage, which should be at the end of the postscript file. This plots the Greek letter alpha at the location 1880 1900. Change (a) to (b) to give beta, etc.



All of these steps may not be needed, and this may not be the most efficient method, but it works.

To incorporate a diagram into a LaTeX document, use the following in your .tex file. This creates a table with two figures, one under the other (which fit well onto one sheet of paper), and works with LaTeX2e. This is what I used to produce the downloadable postscript file mentioned earlier.

\begin{figure}[tbp]
\centering      % or \begin{center} if you don't have \centering
\begin{tabular}{c}
\epsfxsize=130mm
\epsfcbox{pvsdfortex.ps}
\\
\epsfxsize=130mm
\epsfcbox{pvsdbold.ps}
\end{tabular}
\protect \caption{The top figure is the original diagram; the bottom one is ...}
\label{fig:autops}
\end{figure}


If \epsfcbox does not work add the following to the end of your epsf.sty file (I found this to be missing from the epsf.sty file at Woods Hole):

%
% Additions by B.D. Ripley to support horizontally centered boxes and draft mode
%
\epsffull
\def\drawbox#1#2{\vbox{\hrule\hbox to #2{\vrule height #1\hfil\vrule}\hrule}}
%
\def\epsfcbox#1{\global\def\epsfllx{72}\global\def\epsflly{72}%
\global\def\epsfurx{540}\global\def\epsfury{720}%
\def\lbracket{[}\def\testit{#1}\ifx\testit\lbracket
\let\next=\epsfcgetlitbb\else\let\next=\epsfcnormal\fi\next{#1}}%
%
\def\epsfcnormal#1{\epsfgetbb{#1}\epsfcsetgraph{#1}}%
\def\epsfcsetgraph#1{\centerline{\epsfsetgraph{#1}}}
\def\epsfcgetlitbb#1#2 #3 #4 #5]#6{\epsfgrab #2 #3 #4 #5 .\\%
\epsfcsetgraph{#6}}%


Please let me know if this is any use, and of any problems that you encounter. I used AUTO to compute one-parameter bifurcation diagrams. To follow Hopf and fold bifurcations as two parameters varied, I used LOCBIF. To produce diagrams from LOCBIF I implemented the graphics package IDL, but that's another story...

Edwards, A.M. and J. Brindley. (1996).
Oscillatory behaviour in a three-component plankton population model.

Dynamics and Stability of Systems 11(4):347-370.

[Abstract]

Edwards, A.M. (1997).
A Rational Dynamical-Systems Approach to Plankton Population Modelling

Ph.D. Thesis, University of Leeds, U.K.

[Abstract]

Dr. Andrew Edwards
Biological Oceanography Division,
Bedford Institute of Oceanography, B240,
P.O. Box 1006, Dartmouth,
Nova Scotia, B2Y 4A2,