Dislin-9 5 PDF
Dislin-9 5 PDF
Dislin-9 5 PDF
A Data Plotting
Library
by
Helmut Michels
c Helmut Michels, Max-Planck-Institut fuer Sonnensystemforschung, Katlenburg-Lindau 1986 - 2009
All rights reserved.
Contents
1 Introduction 1
3 Introductory Routines 11
3.1 Initialization and Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2 Plotting of Text and Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3 Plotting Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4 Plotting a Page Border, Background and Header . . . . . . . . . . . . . . . . . . . . . . 13
3.5 Sending a Metafile to a Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.6 Including Meta- and Bitmap files into a Graphics . . . . . . . . . . . . . . . . . . . . . 14
5 Plotting Curves 21
5.1 Plotting Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.2 Plotting Legends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.3 Plotting Shaded Areas between Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.4 Plotting Error Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.5 Plotting Vector Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
i
6.1.5 Page Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.1.6 Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
6.1.7 Viewport Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.2 Axis Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.2.1 Modifying the Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.2.2 Modifying the Position and Size . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.2.3 Axis Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
6.2.4 Modifying Ticks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.2.5 Modifying Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
6.2.6 Modifying Axis Titles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.2.7 Suppressing Axis Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6.2.8 Modifying Clipping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.2.9 Framing Axis Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.2.10 Setting Colours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6.2.11 Axis System Titles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6.3 Colours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.3.1 Changing the Foreground Colour . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.3.2 Modifying Colour Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.3.3 Utitily Routines for Colours . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.4 Text and Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.5 Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
6.6 Indices and Exponents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.7 Instruction Alphabet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.8 TeX Instructions for Mathematical Formulas . . . . . . . . . . . . . . . . . . . . . . . . 74
6.8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
6.8.2 Enabling TeX Mode and TeX Options . . . . . . . . . . . . . . . . . . . . . . . 74
6.8.3 Exponents and Indices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6.8.4 Fractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6.8.5 Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6.8.6 Sums and Integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.8.7 Greek Letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.8.8 Mathematical Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.8.9 Alternate Alphabets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.8.10 Function Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
6.8.11 Accents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
6.8.12 Lines above and below Formulas . . . . . . . . . . . . . . . . . . . . . . . . . . 77
6.8.13 Horizontal Spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
6.8.14 Selecting Character Size in TeX Mode . . . . . . . . . . . . . . . . . . . . . . . 77
6.8.15 Colours in TeX Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
6.8.16 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
6.9 Curve Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
6.10 Line Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
6.11 Shading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.12 Attribute Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
6.13 Base Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
6.14 Shielded Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
ii
9.1 Transforming Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
9.2 String Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
9.3 Number Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
9.4 Date Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
9.5 Bit Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
9.6 Byte Swapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
9.7 Binary I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
9.8 Window Terminals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
9.8.1 Clearing the Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
9.8.2 Clearing the Output Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
9.8.3 Multiple Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
9.8.4 Cursor Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
9.9 Elementary Image Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
9.10 Transparency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
9.11 Using Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
9.12 Plotting the MPS Logo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
iii
13.1 Axis Systems and Secondary Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
13.2 Defining the Projection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
13.3 Plotting Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
13.4 Plotting Data Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
13.5 Parameter Setting Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
13.6 Conversion of Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
13.7 User-defined Projections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
13.8 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
14 Contouring 199
14.1 Plotting Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
14.2 Plotting Filled Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
14.3 Generating Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
14.4 Parameter Setting Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
14.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
16 Quickplots 241
16.1 Plotting Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
16.2 Scatter Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
16.3 Bar Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
16.4 Pie Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
16.5 3-D Colour Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
16.6 Surface Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
16.7 Contour Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
16.8 Setting Parameters for Quickplots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
C Examples 267
C.1 Demonstration of CURVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
C.2 Polar Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
C.3 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
C.4 Logarithmic Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
C.5 Interpolation Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
C.6 Line Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
C.7 Legends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
C.8 Shading Patterns (AREAF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
C.9 Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
C.10 Shading Patterns (PIEGRF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
C.11 3-D Bar Graph / 3-D Pie Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
C.12 Surface Plot (SURFUN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
C.13 Map Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
D Index 295
iv
Preface to Version 9.5
This manual describes the data plotting library DISLIN written in the programming languages Fortran
and C. The name DISLIN is an abbreviation for Device-Independent Software LINdau since applications
were designed to run on different computer systems without any changes. The library contains subrou-
tines and functions for displaying data graphically as curves, bar graphs, pie charts, 3-D colour plots,
surfaces, contours and maps.
DISLIN is intended to be a powerful and easy to use software package for programmers and scientists that
does not require knowledge of hardware features of output devices. The routines in the graphics library
are the result of my own work on many projects with different computers and many plotting packages.
There are only a few graphics routines with a short parameter list needed to display the desired graphical
output. A large variety of parameter setting routines can then be called to create individually customized
graphics.
Since the first version of DISLIN was released in Dec. 1986, many changes and corrections have been
made and new features and standards have been added to the software. Some of the new features are el-
ementary image routines, a graphical user interface, filled contour lines, flat and smooth shaded surfaces
and a C interface for reading binary data from Fortran programs. DISLIN supports now several hardware
platforms, operating systems and compilers. A real Fortran 90/95 library is available for most Fortran
90/95 compilers.
Although nearly all the routines and utilities of the software package are written by myself, DISLIN
would not have been possible without the help of many people. I would like to thank several people at
the Max-Planck-Institut in Lindau. First, Dr. W. Degenhardt, Dr. H. J. Mueller and Dr. I. Pardowitz who
gave their friendly assistance. To all the users of DISLIN, I am grateful for your helpful suggestions and
comments. I would especially like to thank the members of the computer center, Friederich Both, Terry
Ho, Godehard Monecke and Michael Bruns for their co-operation. Finally, I am grateful to Linda See
and Erika Eschebach who corrected the English and German manuals with great carefulness. To all of
them, my sincere thanks.
v
vi
Chapter 1
Introduction
DISLIN is a library of subroutines and functions that display data graphically. The routines can be used
with any display device capable of drawing straight lines with the exception of routines that generate 3-D
colour graphics which require special devices. Fortran 77, Fortran 90 and C versions of the library are
available.
DISLIN can display graphic information directly on graphic terminals or store them in metafiles. The
supported display types are VGA, X Windows, Windows API and Tektronix. The supported file formats
are GKSLIN, CGM, HPGL, PostScript, PDF, WMF, PNG, SVG, PPM, BMP, GIF and TIFF. DISLIN
metafiles can be printed on various devices using the DISLIN driver program DISDRV.
Chapter 2 describes the file and page formats and the overall structure of DISLIN programs.
Chapter 3 describes routines for the initialization, termination and plotting of text, numbers and symbols.
Chapter 4 presents the format of two-dimensional axis systems. Axes can be linearly or logarithmically
scaled and labeled with linear, logarithmic, date, time, map and user-defined formats.
Chapter 5 describes the routines for plotting curves. Several curves can appear in one axis system and
can be differentiated by colour, line style and pattern.
Chapter 6 summarizes parameter setting routines that overwrite default plotting parameters such as fonts,
character size and angle, colours, line styles and patterns.
Chapter 7 presents routines to request the values of plot parameters.
Chapter 8 describes the routines for plotting lines, circles, ellipses, vectors and shaded regions.
Chapter 9 describes the utilities available to transform coordinates, sort data and calculate the lengths of
numbers and character strings. Elementary image routines and some special routines that are only useful
for terminal output are also described in this chapter.
Chapter 10 introduces business graphic routines to create bar graphs and pie charts.
Chapter 11 presents 3-D colour graphics where points can be plotted with coloured or shaded rectangles.
Chapter 12 describes routines for 3-D coordinate systems. Axis systems, curves and surfaces can be
drawn from various angular perspectives. All 2-D plotting routines can be used in a 3-D axis system.
Chapter 13 presents 14 different methods to project geographical coordinates onto a plane surface. Sev-
eral base maps are stored in the library for map plotting.
Chapter 14 describes routines for contouring three-dimensional functions of the form Z = F(X,Y). Con-
tours can be filled with solid lines.
Chapter 15 offers routines for creating graphical user interfaces in Fortran and C programs.
Chapter 16 presents some quickplots that are collections of DISLIN routines for displaying data with one
statement.
1
2
Chapter 2
In DISLIN, the graphics are limited to a rectangular area called the page. All lines outside of or crossing
page borders will be suppressed.
The size of the page is determined by the routines SETPAG and PAGE. SETPAG corresponds to a
predefined page while PAGE defines a global page setting. In default mode, there are 100 points per
centimeter and the point (0, 0) is located in the upper left corner (Figure 2.1):
(0, 0)
DIN A4 Landscape
(2969, 2099)
DISLIN can create several types of plotfiles. Device-independent plotfiles or metafiles can be coded in
ASCII or binary format. Device-dependent plotfiles are available for several printers and plotters.
The file formats are:
3
c) a PostScript file
PostScript is an international standard language that has been developed for laserprinters in the
last few years. Some of the PostScript features such as hardware fonts and shading can be used
within DISLIN. PostScript is a trademark of Adobe Systems, Inc.
d) an EPS file
the Encapsulated PostScript file format is similar to the PostScript format. It is useful for
importing PostScript files into other applications.
e) a PDF file
The Portable Document Format is the de facto standard for the electronic exchange of docu-
ments. Compressed and non compressed PDF files can be created by DISLIN. PostScript fonts
can be used for PDF files in the same way as for PostScript files.
f) a HPGL file
Plot vectors and colours are coded in a language recognized by Hewlett-Packard plotters.
g) a WMF file
The Windows metafile format is also supported by DISLIN. Plot vectors are converted to
1/1440 inch. WMF files can contain hardware fonts defined with the DISLIN routine WINFNT.
h) a SVG file
Scalable Vector Graphics (SVG) is a language for describing graphics in XML. SVG files can
be displayed directly by some browsers if a corresponding plug-in is installed. The most of the
standard PostScript fonts are supported by the DISLIN SVG files.
i) a GIF file
The Graphics Interchange Format (c) is the Copyright property of Compuserve Incorporated.
j) a TIFF file
The raster format TIFF can be used for storing graphical output. DISLIN can create 8 bit
palette and truecolour TIFF files.
k) a PNG file
The Portable Network Graphics format is a compressed and therefore very small raster format
for storing graphical output. PNG files can be displayed directly by several Internet browsers.
The compression of PNG files is done in DISLIN with the zlib compression routines written
by Jean-loup Gailly and Mark Adler. DISLIN supports 8 bit palette and truecolour PNG files.
l) a PPM file
The portable pixmap format is a well-known colour image file format in the UNIX world.
There are many tools for converting PPM files into other image formats. The pixel values are
stored in DISLIN PPM files in plain bytes as RGB values.
m) a BMP file
The Windows Bitmap format can be used for storing graphical output. DISLIN can create
uncompressed 8 and 24 bit BMP files.
n) an IMAGE file
This easy raster format is used by DISLIN to store images. The files contain an ASCII header
of 80 bytes and the following image data.
o) a Tektronix, X Window and VGA emulation
Data can be displayed on graphic terminals such as X Window, VGA and Tektronix 4010/4014.
File formats can be set with the routine METAFL. The filename consists of the keyword ’DISLIN’ and
an extension that depends on the file format. An alternate filename can be chosen by calling the routine
SETFIL. Both subroutines must be called before the initialization routine DISINI.
4
2.3 Level Structure of DISLIN
Most routines in DISLIN can be called anywhere during program execution. Certain routines, however,
use parameters from other routines and must be called in a fixed order. DISLIN uses a level structure to
control the order in which routines are called. The levels are:
2.4 Conventions
The following conventions appear throughout this manual for the description of routine calls:
Additional notes:
- CHARACTER keywords may be specified in upper or lower case and may be shortened to
four characters.
- DISLIN stores parameters in common blocks whose names begin with the character ’C’.
Common block names in user programs should not begin with the character ’C’ to avoid
possible name equalities.
- The Fortran logical units 15, 16 and 17 are reserved by DISLIN for plot and parameter files.
- Two types of coordinates are continually referred to throughout the manual: plot coordinates
which correspond to the page and have by default 100 points per cm, and user coordinates
which correspond to the scaling of the axis system.
5
2.6 Programming in C
There are different DISLIN libraries for the programming languages Fortran 77, Fortran 90 and C. The
DISLIN C library is written in the programming language C and useful for C programmers.
Though it is possible to call C routines in Fortran programs and Fortran subroutines in C programs, it
is easier to use the corresponding library. Especially, the passing of strings can be complicate in mixed
language programming.
The number and meaning of parameters passed to DISLIN routines are identical for all libraries. The
Fortran versions use INTEGER, REAL and CHARACTER variables while the C library uses int, float
and char variables. A detailed description of the syntax of C routines is given by the utility program
DISHLP or can be found in the header file ’dislin.h’ which must be included in all C programs.
Here is a short example for a DISLIN C program:
#include <stdio.h>
#include ”dislin.h”
main()
{
disini ();
messag (”This is a test”, 100, 100);
disfin ();
}
An example for a DISLIN C++ programm is:
#include <iosteam>
namespace dislin {
#include ”dislin.h”
}
main()
{
dislin::disini ();
dislin::messag (”This is a test”, 100, 100);
dislin::disfin ();
}
- All program units in Fortran 90 programs that contain calls to DISLIN routines should in-
clude the statement ’USE DISLIN’. The module ’DISLIN’ contains interfaces for all DIS-
LIN routines and enables the compiler to check the number and type of parameters passed
to DISLIN routines.
- Since version 9.1 of DISLIN, the array declarations in the DISLIN module file are changed
from assumed-shape arrays to explicit-shape arrays for native Fortran 90 libraries. All DIS-
LIN Fortran 90 libaries (native of wrapper) use now the same interfaces. A missing ’USE
DISLIN’ statement for a native Fortran 90 library of DISLIN should no longer cause a
general protection fault.
For example:
6
PROGRAM TEST
USE DISLIN
CALL DISINI ()
CALL MESSAG (’This is a test’, 100, 100)
CALL DISFIN ()
END PROGRAM TEST
option is an optional parameter containing a minus sign and a character. The follow-
ing options can be used on all computers:
-c for compiling programs before linking.
-cpp for compiling a C++ program before linking.
-r for running programs after linking.
-a for compiling, linking and running programs.
-r8 for using the double precision libraries of DISLIN.
main is the name of the main program.
Additional notes: - If DLINK is called without parameters, the description of the program will be
printed on the screen. There may be other local features available depending
upon the operating system used.
- Linking of C programs should be done with the procedure CLINK.
- Linking of Fortran 90 programs should be done with the procedure F90LINK.
- The most DISLIN distributions contain libraries for single precision (32 bit)
and double precision (64 bit) floatingpoint parameters. The double precision
libraries can be identified by the term ’ d’ in the library filename.
routine is the name of a DISLIN routine or a question mark. For a question mark, all
routine names will be listed. An empty input terminates the program.
options is an optional field of keywords (see DISHLP).
DISMAN
DISMAN prints an ASCII version of the DISLIN manual on the screen.
7
Command: DISMAN [options]
DISDRV
DISDRV sends a plotfile to a device. CGM and GKSLIN files can be used for all devices while device-
dependent plotfiles can only be sent to corresponding devices.
DISIMG
DISIMG displays an image file on the screen, or converts it to PostScript and TIFF.
filename is the name of the image file. The file must be created with the routine RIM-
AGE.
device is the device name.
options is an optional field of keywords (see DISIMG).
DISMOV
DISMOV displays a sequence of image files.
filename is the name of a data file where the filenames of the images are stored (1 line
for each filename). The images must be created with the routine RIMAGE.
device is the device name.
options is an optional field of keywords (see DISMOV).
DISTIF
DISTIF displays a TIFF file created by DISLIN on the screen, or converts it to PostScript and an image
format.
filename is the name of the TIFF file. The file must be created with DISLIN.
device is the device name.
options is an optional field of keywords (see DISTIF).
DISGIF
DISGIF displays a GIF file, or converts it to another format.
8
filename is the name of the GIF file.
device is the device name.
options is an optional field of keywords (see DISGIF).
DISAPS
DISAPS converts an ASCII file to a PostScript file. Several page layouts can be defined.
Additional note: If a utility program is called without parameters, a description of possible pa-
rameters will be printed on the screen. DISDRV, for example, lists the local
output devices available.
DISGCL
DISGCL is an interpreter for DISLIN. All DISLIN statements can be written to a script file and then be
executed with DISGCL, or can be entered in an interactive mode. High-level language elements such
variables, operators, expressions, array operations, loops and user-defined functions van be used within
DISGCL.
filename is the name of a DISGCL script file. The extension ’.gcl’ is optional.
args are optional arguments that can be passed to DISGCL scripts (see DISGCL).
options is an optional field of keywords separated by blanks (see DISGCL).
http://www.dislin.de http://www.mps.mpg.de/dislin
Helmut Michels
Max-Planck-Institut fuer Sonnensystemforschung
D-37191 Katlenburg-Lindau, Max-Planck-Str. 2, Germany
E-Mail: [email protected]
Tel.: +49 5556 979 334
Fax: +49 5556 979 240
9
2.12 License Information
DISLIN is free for non-commercial use. Licenses for commercial use are available from the site
http://www.dislin.de. Commercial use means selling of programs linked with DISLIN or using DIS-
LIN in an environment related to business.
This manual of the data plotting software DISLIN can be copied and distributed freely.
10
Chapter 3
Introductory Routines
DISFIN terminates DISLIN and prints a message on the screen. The level is set back to 0.
The call is: CALL DISFIN level 1, 2, 3
or: void disfin ();
Additional note: The printing of the protocol in DISFIN can be suppressed with the routine
ERRMOD.
MESSAG
MESSAG plots text.
NUMBER
NUMBER plots a floating-point number or integer.
The call is: CALL NUMBER (X, NDIG, NX, NY) level 1, 2, 3
or: void number (float x, int ndig, int nx, int ny);
X is a floating-point number.
NDIG is the number of digits plotted after the decimal point. If NDIG = -1, X will be
plotted as an integer. The last digit of X will be rounded up.
NX, NY are the coordinates of the upper left corner.
11
RLMESS and RLNUMB are corresponding routines for user coordinates. They can be used for plotting
text and numbers in an axis system after a call to GRAF.
Additional notes: - To continue character strings and numbers on the same line, the coordinates
(999, 999) should be sent to MESSAG and NUMBER. The text or numbers
will be plotted after the last plotted text character or number.
- The angle and height of the characters can be changed with the routines AN-
GLE and HEIGHT.
- The format of numbers can be modified with the routines NUMFMT and NU-
MODE.
- Text and numbers can be plotted in a box if the routine FRMESS is used.
- The starting point of text and numbers can be interpreted as upper left, upper
center and upper right point if the routine TXTJUS is used.
SYMBOL
The routine SYMBOL plots symbols.
NSYM is a symbol number between 0 and 23. Available symbols are given in the
Appendix C.
NX, NY is the centre of the symbol in plot coordinates.
RLSYMB
RLSYMB plots a symbol where the centre is specified by user coordinates.
12
3.4 Plotting a Page Border, Background and Header
PAGERA
PAGERA plots a border around the page.
PAGFLL
The routine PAGFLL fills the page with a colour.
The call is: CALL PAGFLL (NCLR) level 1, 2, 3
or: void pagfll (int nclr);
PAGHDR
PAGHDR plots a page header at a corner of the page. The header line contains date, time and user-defined
information.
The call is: CALL PAGHDR (CSTR1, CSTR2, IOPT, IDIR) level 1, 2, 3
or: void paghdr (char *cstr1, char *cstr2, int iopt, int idir);
CSTR1 is a character string preceding the header line.
CSTR2 is a character string following the header line.
IOPT is the page corner where the header is plotted:
=1 is the lower left corner.
=2 is the lower right corner.
=3 is the upper right corner.
=4 is the upper left corner.
IDIR is the direction of the header line:
=0 is horizontal.
=1 is vertical.
Additional note: The character size of the header line is 0.6 * NH where NH is the parameter
used in HEIGHT.
CDEV is the name of the device. ’CONS’ refers to the graphics screen, ’XWIN’ to
a X Window terminal, ’PSCi’ to a PostScript printer, ’KYOi’ to a Kyocera
laserprinter with Prescribe and ’HPLi’ to a HP-plotter. The keyword ’NONE’
can be used to delete a metafile with no device plotting.
13
CSTAT is a status parameter and can have the values ’DELETE’ and ’KEEP’.
Additional note: SYMFIL calls the DISLIN driver utility DISDRV. The parameter ’REVERS’
can be passed to DISDRV from SYMFIL if the routine SCRMOD is called
before with the parameter ’REVERS’.
INCFIL
The routine INCFIL includes a GKSLIN or CGM metafile created by DISLIN, or general BMP and GIF
files into a graphics.
The call is: CALL INCFIL (CFIL) level 1, 2, 3
or: void incfil (char *cfil);
14
Chapter 4
GRAF
GRAF plots a two-dimensional axis system.
The call is: CALL GRAF (XA, XE, XOR, XSTEP, YA, YE, YOR, YSTEP) level 1
or: void graf (float xa, float xe, float xor, float xstep,
float ya, float ye, float yor, float ystep);
Additional notes: - GRAF must be called in level 1 and automatically sets the level to 2. When
plotting more than 1 axis system on a page, ENDGRF must be called in be-
tween each new set of axes in order to set the level back to 1.
- The position of the lower left corner and the size of an axis system can be
changed with the routines AXSPOS and AXSLEN.
- The axis scaling is linear by default and can be changed with AXSSCL. For
logarithmic scaling, the corresponding parameters in GRAF must be exponents
of base 10.
- One of several label types can be chosen with the routine LABELS or user-
defined with MYLAB. Single labels can be suppressed by calling AXENDS.
- The routine NAME defines axis titles.
- The number of ticks between axis labels can be changed with the routine
TICKS.
- SETGRF can be used to remove a piece of or complete axis from an axis
system.
- If the numerical value of the lower limit of an axis is larger than the upper limit
and the label step is negative, axis scaling will be in descending order.
15
- The routine FRAME defines the thickness of a frame plotted around an axis
system. A frame can also be plotted outside of GRAF with the statement
CALL BOX2D.
- A crossed axis system can be defined with CALL AXSTYP (’CROSS’).
The following routine GRAFP can be used to plot a polar axis system and set up a scale for polar axes.
GRAFP
The call is: CALL GRAFP (XE, XOR, XSTEP, YOR, YSTEP) level 1
or: void grafp (float xe, float xor, float xstep, float yor, float ystep);
XE is the upper limit of the X-axis (radius coordinate).
XOR, XSTEP are the first X-axis label and the step between labels.
YOR, YSTEP are the first Y-axis label and the step between labels specified in degrees. The
Y-axis is scaled from 0 to 360 degrees.
Additional notes: - The direction and position of the angle labels can be modified with the routine
POLMOD.
- GRAFP is a new name for the old routine POLAR, since polar is also a C99
function. The old routine POLAR is still in the DISLIN libraries.
ENDGRF
The routine ENDGRF terminates an axis system and sets the level back to 1.
TITLE
This routine plots a title over an axis system. The title may contain up to four lines of text designated
with TITLIN.
Additional note: All lines are centred by default but can be left- or right-justified using TITJUS.
16
4.4 Plotting Grid Lines
GRID
The routine GRID overlays a grid on an axis system.
GRDPOL
The routine GRDPOL plots a polar grid.
Example:
The statements
CALL AXSLEN (1400,1400)
CALL GRAF (-3., 3., -3., 1., -3., 3., -3., 1.)
CALL GRDPOL (3, 16)
produce the following figure:
3.0
2.0
1.0
0.0
-1.0
-2.0
-3.0
-3.0 -2.0 -1.0 0.0 1.0 2.0 3.0
AXGIT
The routine AXGIT plots vertical and horizontal lines through X = 0 and Y = 0.
The call is: CALL AXGIT level 2, 3
or: void axgit ();
17
Additional note: The statement CALL XAXGIT plots only the line Y = 0 while CALL YAXGIT
plots only X = 0.
CROSS
The routine CROSS plots vertical and horizontal lines with additional ticks through X = 0 and Y = 0.
The call is: CALL CROSS level 2, 3
or: void cross ();
Additional note: The statement CALL XCROSS plots only the line Y = 0 while CALL
YCROSS plots only X = 0.
The call is: CALL XAXIS (A, B, OR, STEP, NL, CSTR, IT, NX, NY)
or: void xaxis (float a, float b, float or, float step, int nl, char *cstr, int it,
int nx, int ny);
18
NL is the length of the axis in plot coordinates.
CSTR is a character string containing the axis name.
IT indicates how ticks, labels and the axis name are plotted.
If IT = 0, they are plotted in a clockwise direction. If IT = 1, they are plotted
in an counter-clockwise direction.
NX, NY are the plot coordinates of the axis start point. The X-axis will be plotted from
left to right and the Y-axis from bottom to top.
Additional notes: - Secondary axes can be called from level 1, 2 or 3. Note again that secondary
axes do not change the scaling of an axis system defined by GRAF. Similarly,
curves cannot be plotted with only secondary axes, they require a call to GRAF.
- As in GRAF, the parameters of logarithmic axes must be exponents of base 10.
- User-defined labels may also be plotted on secondary axes with MYLAB and
the argument ’USER’ in the routine LABELS. The number of ticks can be
changed by calling TICKS.
V1, V2 are the lower and upper limits of the axis. If V1 > V2, the calculated parame-
ters will be in descending order.
COPT is a character string that can have the values ’NOEXTEND’ and ’EXTEND’.
For COPT = ’EXTEND’, the calculated axis limits are extended to a full axis
step. Otherwise, V1 and V2 are used as axis limits.
CAX is a character string that defines the axis. CAX can have the values ’X’, ’Y’,
and ’Z’.
A, B are the calculated limits of the axis.
OR, STP are the first axis label and the step between labels.
NDIG is the calculated number of digits after the decimal point that should be set
with the routine LABDIG for the labels.
Additional notes: - The same algorithm as in SETSCL for setting automatic axis scaling is applied
to GAXPAR.
- The current axis settings such as linear or logarithmic scaling are used by
GAXPAR. For logarithmic scaling, the parameters V1 and V2 must be ex-
ponents of base 10.
19
20
Chapter 5
Plotting Curves
This chapter describes how to plot curves with lines and symbols. Several curves can be plotted in one
axis system and can be differentiated by colour, line style and pattern. Curve attributes can be plotted in
a legend.
CURVE
CURVE connects data points with lines or plots them with symbols.
XRAY, YRAY are arrays that contain X- and Y-coordinates. For a polar scaling, XRAY must
hold the radial values and YRAY the angular values expressed in radians.
N is the number of data points.
Additional notes: - CURVE must be called after GRAF or GRAFP from level 2 or 3.
- By default, data points that lie outside of an axis system are listed on the screen.
The listing can be suppressed with the routine NOCHEK.
- For a logarithmic scaling of an axis, CURVE suppresses the plotting of curves
and prints a warning if some corresponding data coordinates have non positive
values. After the statement CALL NEGLOG (EPS), where EPS is a small
positiv floating-point number, CURVE will use the value EPS for non positive
values.
- CURVE suppresses lines outside the borders of an axis system. Suppressing
can be disabled with NOCLIP or the margins of suppression can be changed
with GRACE.
- INCMRK determines if CURVE plots lines or symbols.
- When plotting several curves, attributes such as colour and line style can be
changed automatically by DISLIN or directly by the user. The routine CHN-
CRV defines which attributes are changed automatically. The routines COLOR
or SETCLR are used to define colours, SOLID, DOT, DASH, CHNDOT,
CHNDSH, DOTL, DASHM and DASHL to define line styles and MARKER
to define symbols plotted with the routine CURVE.
- Different data interpolation methods can be chosen with POLCRV.
21
5.2 Plotting Legends
To differentiate multiple curves in an axis system, legends with text can be plotted. DISLIN can store up
to 30 curve attributes such as symbols, thicknesses, line styles and colours and these can be incorporated
in a legend.
Legends are created with the following steps:
(1) define a character variable used to store the lines of text in the legend
(2) initialize the legend
(3) define the lines of text
(4) plot the legend.
The corresponding routines are:
LEGINI
LEGINI initializes a legend.
The call is: CALL LEGINI (CBUF, NLIN, NMAXLN) level 1, 2, 3
or: void legini (char *cbuf, int nlin, int nmaxln);
CBUF is a character variable used to store the lines of text in the legend. The variable
must be defined by the user to have at least NLIN * NMAXLN characters.
NLIN is the number of text lines in the legend.
NMAXLN is the number of characters in the longest line of text.
LEGLIN
LEGLIN stores lines of text for the legend.
The call is: CALL LEGLIN (CBUF, CSTR, ILIN) level 1, 2, 3
or: void leglin (char *cbuf, char *cstr, int ilin);
LEGEND
LEGEND plots legends.
The call is: CALL LEGEND (CBUF, NCOR) level 2, 3
or: void legend (char *cbuf, int ncor);
22
Additional notes: The following routines change the position and appearance of a legend. They
must be called after LEGINI except for the routines FRAME and LINESP.
LEGPAT
The routine LEGPAT stores curve attributes plotted in legends. Normally, this is done automatically by
routines such as CURVE and BARS.
The call is: CALL LEGPAT (ITYP, ITHK, ISYM, ICLR, IPAT, ILIN) level 1, 2, 3
or: void legpat (int ityp, int ithk, int isym, int iclr, long ipat, int ilin);
ITYP is the line style between -1 and 7 (see LINTYP). IF ITYP = -1, no line will be
plotted in the legend line.
ITHK defines the thickness of lines (> 0).
ISYM is the symbol number between -1 and 21. If ISYM = -1, no symbol will be
plotted in the legend line.
ICLR is the colour value. If ICLR = -1, the current colour will be used.
IPAT is the shading pattern (see SHDPAT). If IPAT = -1, no pattern will be plotted
in the legend line.
ILIN is the legend line between 1 and NLIN.
Additional notes: - The routine LEGPAT is useful to create legends without calls to CURVE.
- LEGPAT must be called after LEGINI.
LEGOPT
The routine LEGOPT modifies the appearance of legends.
XF1 is a multiplier for the length of the pattern field. The length is XF1 * NH,
where NH is the current character height. If XF1 = 0., the pattern field will be
suppressed.
XF2 is a multiplier for the distance between legend frames and text. The distance
is XF2 * NH * XSPC, where XSPC is the spacing between legend lines (see
LINESP).
23
XF3 is a multiplier for the spacing between multiple text lines. The space is XF3 *
NH * XSPC.
Default: (4.0, 0.5, 1.0).
LEGVAL
The routine LEGVAL modifies the appearance of legends.
COPT is a character string that can have the value ’SYMBOL’. For COPT = ’SYM-
BOL’, the parameter X defines the size of symbols used in legends. The size
is X * NH, where NH is the current character height.
Default: (0.8, ’SYMBOL’).
SHDCRV
SHDCRV plots a shaded area between two curves.
The call is: CALL SHDCRV (X1RAY, Y1RAY, N1, X2RAY, Y2RAY, N2) level 2, 3
or: void shdcrv (float *x1ray, float *y1ray, int n1, float *x2ray, float *y2ray,
int n2);
X1RAY, Y1RAY are arrays with the X- and Y-coordinates of the first curve. Values are not
changed by SHDCRV.
N1 is the number of points in the first curve.
X2RAY, Y2RAY are arrays with the X- and Y-coordinates of the second curve. Values are not
changed by SHDCRV.
N2 is the number of points in the second curve.
Additional notes: - The maximum number of data points cannot be greater than 25000 in Fortran
77 programs. There is no restriction for Fortran 90 and C.
- Different shading patterns can be selected with SHDPAT. The pattern number
will automatically be incremented by 1 after a call to SHDCRV.
- Legends may be plotted for shaded curves.
- The routine NOARLN will suppress border lines around shaded areas.
ERRBAR
The routine ERRBAR plots error bars.
The call is: CALL ERRBAR (XRAY, YRAY, E1RAY, E2RAY, N) level 2, 3
or: void errbar (float *xray, float *yray, float *e1ray, float *e2ray, int n);
24
E1RAY, E2RAY are arrays that contain the errors. Lines will be drawn from YRAY - E1RAY
to YRAY + E2RAY.
N is the number of data points.
Additional notes: - Horizontal bars will be drawn after CALL BARTYP (’HORI’).
- A symbol can be selected with MARKER and the symbol size with HSYMBL.
FIELD
The routine FIELD plots a vector field where the start and end points of the vectors are already calculated.
The vectors are displayed as arrows.
The call is: CALL FIELD (X1RAY, Y1RAY, X2RAY, Y2RAY, N, IVEC) level 2, 3
or: void field (float *x1ray, float *y1ray, float *x2ray, float *y2ray, int n, int ivec);
X1RAY, Y1RAY are arrays that contain the X- and Y-coordinates of the start points.
X2RAY, Y2RAY are arrays that contain the X- and Y-coordinates of the end points.
N is the number of vectors.
IVEC is an integer that specifies the form of the arrows (see VECTOR).
VECFLD
The routine VECFLD plots a vector field of given vectors and positions. The vectors are displayed as
arrows.
The call is: CALL VECFLD (XVRAY, YVRAY, XPRAY, YPRAY, N, IVEC) level 2, 3
or: void vecfld (float *xvray, float *yvray, float *xpray, float *ypray, int n, int
ivec);
XVRAY, YVRAY are arrays that contain the X- and Y-coordinates of the vectors.
XPRAY, YPRAY are arrays that contain the X- and Y-coordinates of the start points.
N is the number of vectors.
IVEC is an integer that specifies the form of the arrows (see VECTOR).
Additional notes: - The length of the arrows is atomatically scaled by DISLIN in the routine
VECFLD. This behavour can be changed with the routine VECOPT, that may
also modify the apperance of arrows.
- The vectors can be scaled with different colours if the routine VECCLR is
called before with the parameter -2. If VECFLD and FIELD are called after
GRAF, the minimum and maximum of the vector lengths are used for colour
scaling. If VECFLD and FIELD are called after GRAF3, the Z-scaling in
GRAF3 is used for calculating colours.
25
26
Chapter 6
All parameters in DISLIN have default values set by the initialization routine DISINI. This chapter
summarizes subroutines that allow the user to alter default values. The following routines can be called
from level 1, 2 or 3 except for those noted throughout the chapter. Subroutines that can only be called
from level 0 must appear before DISINI. In general, parameter setting routines should be called between
DISINI and the plotting routines they affect.
RESET
RESET sets parameters back to their default values.
UNITS
The routine UNITS defines the plot units.
PAGORG
The routine PAGORG sets the origin of the page. By default, the page origin is located in the upper left
corner of the page.
27
The call is: CALL PAGORG (COPT) level 1, 2, 3
or: void pagorg (char *copt);
COPT is a character string that can have the values ’TOP’ and ’BOTTOM’. The key-
word ’TOP’ sets the page origin to the upper left corner, ’BOTTOM’ to the
lower left corner.
Default: COPT = ’TOP’.
ORIGIN
In DISLIN, all lines are plotted relative to a point on the page which is by default identical with the page
origin. Modifying this point by ORIGIN produces a shifting of plot vectors on the page.
NX0, NY0 are the coordinates of the origin. Default: (0, 0).
METAFL
METAFL defines the metafile format.
28
= ’XWIN’ defines a window for graphical output. By default, the size of the window is
nearly 2/3 of the size of the screen.
Default: CFMT = ’GKSL’.
Notes: - The default size of TIFF, GIF, PNG, PPM, BMP, IMAGE, SVG and virtual
files is set to 853 x 603 points but can be modified with the routine WINSIZ.
The size of graphical windows can also be changed with WINSIZ.
- The default background colour for graphical windows and image formats such
as TIFF, GIF and PNG is black but can be changed to white with the routine
SCRMOD.
- The format of VIRT, TIFF, PNG, BMP and IMAGE is by default a 8 bit palette
format, but can be changed to a truecolour format with the parameter ’RGB’ in
the routine IMGFMT. GIF files created by DISLIN have always a 8 bit palette
format.
SETFIL
By default, the plotfile name consists of the keyword ’dislin’ and an extension that depends on the file
format. An alternate filename can be set with SETFIL.
FILMOD
The routine FILMOD determines if a new plotfile name is created for existing files.
FILOPT
The routine FILOPT modifies rules for creating file version names.
29
that leading zeros are used in the version number. The keyword ’DIGITS’
sets the number of digits that are used for version numbers. For that keyword,
COPT can have the values ’2’, ’3’, ’4’, ’5’ and ’6’.
Defaults: (’SEPARATOR’, ’ ’), (’NUMBER’, ’SHORT’),
(’DIGITS’, ’4’).
SCRMOD
Normally, the background of screens and image formats such as TIFF, GIF, BMP and PNG is set to
’BLACK’. With the routine SCRMOD, the back and foreground colours can be swapped.
CMOD = ’AUTO’ uses a ’BLACK’ background colour for screen output and image files.
CMOD = ’REVERS’ means that the background colour is set to ’WHITE’ and the foreground colour
to ’BLACK’.
CMOD = ’NOREV’ means that the background colour is set to ’BLACK’ and the foreground colour
to ’WHITE’.
Default: CMOD = ’AUTO’.
CGMBGD
The routine CGMBGD sets the background colour for CGM files.
XR, XG, XB are the RGB coordinates of the background colour in the range 0 to 1.
Default: (1., 1., 1.).
CGMPIC
The routine CGMPIC modifies the picture ID in CGM files. The picture ID may be referenced by some
browsers.
TIFMOD
The routine TIFMOD modifies the physical resolution of TIFF files.
30
BMPMOD
The routine BMPMOD modifies the physical resolution of BMP files.
WMFMOD
The routine WMFMOD modifies the appearance of WMF files.
PDFMOD
The routine PDFMOD selects between compressed and non compressed PDF files, and can enable PDF
buffer output instead of file output.
PDFMRK
The routine PDFMRK writes bookmarks to PDF files. This makes it possible to navigate through PDF
files that contain multiple pages.
31
GIFMOD
The routine GIFMOD enables transparency for GIF files.
PNGMOD
The routine PNGMOD enables transparency for PNG files.
HPGMOD
The routine HPGMOD defines options for HPGL files.
IMGFMT
The routine IMGFMT defines palette or truecolour mode for DISLIN image formats such as TIFF, PNG,
BMP and IMAGE.
32
or: void page (int nxp, int nyp);
NXP, NYP are the length and height of the page in plot coordinates. The lower right corner
of the page is the point (NXP-1, NYP-1).
Default: (2970, 2100).
SETPAG
SETPAG selects a predefined page format.
XFAC is the scaling factor by which the entire plot is scaled up or down.
Default: XFAC = 1.
33
SCLMOD
The method by which graphics are scaled to the hardware pages of devices such as a graphics terminal
can be selected with the routine SCLMOD.
The call is: CALL SCLMOD (CMOD) level 0
or: void sclmod (char *cmod);
CMOD = ’DOWN’ means that graphics will be scaled down if the hardware page of a device is
smaller than the plotting page.
= ’FULL’ means that the graphics will be scaled up or down depending upon the size of
the hardware page.
Default: CMOD = ’DOWN’.
Additional notes: - The size of a graphics screen will be interpreted as DIN A4 landscape. This
means that by default graphics which are smaller than DIN A4 will not fill the
entire screen.
- SCLFAC and SCLMOD can affect each other.
PAGMOD
GKSLIN and CGM files can be rotated by 90 degrees to use the full hardware page of a device. In
general, this is done automatically by the driver program.
6 Portrait X
Y Landscape
-
X Y
NEWPAG
NEWPAG creates a new page.
34
Additional notes: - PostScript, PDF and CGM files can store multiple pages. For other output
formats, NEWPAG is not useful.
- On Window terminals, NEWPAG is waiting for a mouse button 2 event before
displaying the next page. This mode can be changed with the routine WIN-
MOD. On other terminals, NEWPAG has the same effect as ERASE.
HWPAGE
The routine HWPAGE defines the size of the PostScript hardware page.
NW, NH are the width and height of the PostScript hardware page in plot coordinates.
Default: (1950, 2800).
HWORIG
The routine HWORIG defines the hardware origin of the PostScript hardware page.
HWSCAL
The routine HWSCAL modifies the scale operator in PostScript files.
ERRMOD
The printing of warnings and the output of the protocol in DISFIN can be disabled with the routine
ERRMOD.
CKEY is a character string that can have the values ’WARNINGS’, ’CHECK’, ’PRO-
TOCOL’ and ’ALL’. ’WARNINGS’ means the error messages about bad pa-
rameters passed to DISLIN routines, ’CHECK’ the out of range check of co-
ordinates passed to plotting routines such as CURVE and ’PROTOCOL’ the
output of the protocol in DISFIN.
CMOD is a character string that can have the values ’ON’ and ’OFF’. For CKEY =
’PROTOCOL’, CMOD can have the additional value ’FILE’ that means that
the protocol in DISFIN is also written to the error file.
Default: (’ALL’, ’ON’)
35
ERRDEV
The routine ERRDEV defines the output device for DISLIN warnings. By default, warnings are written
to the screen.
The call is: CALL ERRDEV (COPT) level 0
or: void errdev (char *copt);
COPT is a character string that can have the values ’CONS’, ’FILE’ and ’APPEND’.
’APPEND’ means that all error messages are appended to the same file while
for the keyword ’FILE’ a new error file is created for each DISINI/DISFIN
cycle.
Default: COPT = ’CONS’.
ERRFIL
By default, the name of the error file is ’dislin.err’. An alternate filename can be set with ERRFIL.
The call is: CALL ERRFIL (CFIL) level 0
or: void errfil (char *cfil);
CFIL is a character string that contains the filename.
UNIT
UNIT defines the logical unit used for printing error messages and listing data points that lie outside of
the axis scaling.
WINAPP
The routine WINAPP defines if a DISLIN program should look like a Windows console, or more like a
Windows program. If Windows mode is selected, all warnings are written to an error file and the protocol
in disfin is displayed in a widget.
The call is: CALL WINDOW (NX, NY, NW, NH) level 0, 1, 2, 3
or: void window (int nx, int ny, int nw, int nh);
36
NX, NY are the screen coordinates of the upper left corner.
NW, NH are the width and height of the window in screen coordinates.
Additional note: In general, the screen size is 1280 * 1024 pixels.
WINSIZ
This routine defines the size of windows and the resolution of DISLIN image formats such as TIFF, PNG,
BMP, PPM and IMAGE. By default, the window size is set to 2/3 of the screen size, and the resolution
of image formats is 853 x 603 pixels.
CLRMOD
The routine CLRMOD defines the colour mode used for output on window terminals.
X11MOD
The routine X11MOD enables or disables backing store for graphic windows.
WINMOD
The routine WINMOD affects the handling of windows in the termination routine DISFIN.
37
= ’FULL’ means that DISFIN is waiting for a mouse button 2 event. After program
continuation, all windows are deleted.
= ’NOHOLD’ means that DISFIN is not waiting for a mouse button 2 event. After a call to
DISFIN, all windows are deleted.
= ’NOERASE’ means that the program is still blocked in DISFIN but windows will not be
deleted after program continuation.
= ’NONE’ means that the program is not blocked in DISFIN and windows are not deleted.
= ’DELAY’ means that the program is blocked for a short time in DISFIN before it is
continued. The delay time can be defined with the routine WINOPT.
Default: CMOD = ’FULL’.
WINOPT
The routine WINOPT sets the delay time for the keyword ’DELAY’ in WINMOD.
The call is: CALL WINOPT (IOPT, CKEY) level 1, 2, 3
or: void winopt (int iopt, char *ckey);
IOPT is the delay time in seconds or milliseconds.
CKEY is a character string that can have the values ’DELAY’ and ’MDELAY’. For
CKEY = ’MDELAY’, IOPT must contain milliseconds, otherwise seconds.
Default: (10, ’DELAY’).
WINKEY
The routine WINKEY enables a an additional key that can be used for program continuation is DISFIN.
Normally, the mouse button 2 can be used for closing the graphics window.
The call is: CALL WINKEY (CKEY) level 1, 2, 3
or: void winkey (char *ckey);
CKEY is a character string that can have the values ’NONE’, ’RETURN’ and ’ES-
CAPE’.
Default: CKEY = ’NONE’.
SETXID
The routine SETXID defines an external graphics window for X11 and Windows displays. All graphical
output is sent to the external window. For X11 displays, an external pixmap can also be defined.
The call is: CALL SETXID (ID, CTYPE) level 0, 1, 2, 3
or: void setxid (int id, char *ctype);
ID is the window or pixmap ID.
CTYPE is a character string that can have the values ’NONE’, ’WINDOW’, ’PIXMAP’
and ’WIDGET’. For the keyword ’WIDGET’, the ID of a DISLIN draw widget
can be used.
Default: (0, ’NONE’).
Additional notes: - If an external pixmap is used, backing store must also be enabled with the
routine X11MOD.
- An external window is not erased by DISINI. This can be done with the routine
ERASE.
- External windows are not blocked in DISFIN (see WINMOD).
- External windows can also be used for multiple DISLIN windows that are
defined with the routine OPNWIN.
38
6.2 Axis Systems
This section describes subroutines that allow the user to modify axis systems. The position of an axis
system, the size, the scaling, ticks, labels and axis titles can be altered in any way. Some of the routines
defining axis attributes can also be used with secondary axes. Routines that set axis attributes can be
used for one or for any combination of axes. The axes are identified by a character string that can contain
the characters ’X’, ’Y’ and ’Z’ in any combination.
3.0 3.0
1.0 1.0
Y-axis
-5.0 -5.0
-4.0 -2.0 0.0 2.0 4.0
X-axis
Figure 6.2: Rectangular and Crossed Axis Systems
AXSORG
AXSORG is an alternate routine for defining the position of a crossed axis system.
39
The call is: CALL AXSORG (NX, NY) level 1
or: void axsorg (int nx, int ny);
NX, NY are plot coordinates that define the position of the origin of a crossed axis
system.
AXSLEN
AXSLEN defines the size of an axis system.
CENTER
A call to the routine CENTER will centre the axis system on the page. All elements of an axis system,
including titles, axis labels and names, will be taken into consideration. The centralisation is done by
GRAF through changing the position of the origin. Therefore, all plotting routines called after GRAF
will work with the new origin.
AXSSCL
This routine sets the axis scaling to logarithmic or linear.
SETSCL
The parameters in GRAF will be calculated automatically by DISLIN if the routine SETSCL is used. In
this case, GRAF must have dummy parameters in which DISLIN returns the calculated values.
40
The call is: CALL SETSCL (XRAY, N, CAX) level 1
or: void setscl (float *xray, int n, char *cax);
XRAY is a vector that contains user coordinates. SETSCL calculates the minimum
and maximum values of the data and stores them in a common block.
N is the number of points in XRAY.
CAX is a character string that defines the axes. CAX can have the additional val-
ues ’XRESET’, ’YRESET’, ’ZRESET’ and ’RESET’ for disabling automatic
scaling. The parameter ’RESET’ resets automatic scaling for all axes.
Additional notes: - SETSCL can be used with linear and logarithmic scaling and with all label
types.
- The calculation of scaling and label values is done by GRAF. The minimum
and maximum of the data are always used for the lower and upper limits of an
axis while even values are calculated for the labels.
- The number of digits after the decimal point will be set automatically.
- If the scaling of an axis is logarithmic, labels will be plotted with the format
’LOG’.
TICKS
This routine is used to define the number of ticks between axis labels.
TICPOS
This routine defines the position of ticks.
41
TICLEN
TICLEN sets the lengths of major and minor ticks.
TICMOD
The routine TICMOD modifies the plotting of minor tick marks on calendar axes. By default, a major
tick is plotted at each date label and no minor ticks are plotted.
The call is: CALL TICMOD (COPT, CAX) level 1, 2, 3
or: void ticmod (char *copt, char *cax);
COPT is a character string defining the tick marks.
= ’NONE’ means that no minor ticks will be plotted.
= ’DAYS’ means that ticks will be plotted for every day.
= ’MONTH’ means that ticks will be plotted for every month.
= ’DMONTH’ means that ticks will be plotted for every second month.
= ’QUARTER’ means that ticks will be plotted on the first of January, April, July and October.
= ’HALF’ means that ticks will be plotted on the first of January and July.
= ’YEAR’ means that ticks will be plotted for every year.
CAX is a character string that defines the axes.
Default: (’NONE’, ’XYZ’).
LOGTIC
The appearance of minor ticks on logarithmic axes differs slightly from linear axes. By default, loga-
rithmic minor ticks are generated automatically if the label step is 1 or -1 and if the number of ticks in
TICKS is greater than 1. If the step has another value, minor ticks are plotted as specified in TICKS.
This algorithm can be modified with LOGTIC.
42
6.2.5 Modifying Labels
LABELS
LABELS determines which label types will be plotted on an axis.
MYLAB
MYLAB defines user labels.
43
ITICK is the tick number where the label will be plotted (≤ 20). Tick numbering
starts with 1.
CAX is a character string that defines the axes.
LABTYP
LABTYP defines horizontal or vertical labels.
LABPOS
LABPOS defines the position of labels.
LABJUS
LABJUS defines the alignment of axis labels.
44
LABDIG
This routine sets the number of digits after the decimal point displayed in labels.
INTAX
With the routine INTAX, all axes will be labeled with integers.
LABDIS
This routine sets the distance between labels and ticks.
The call is: CALL LABDIS (NDIS, CAX) level 1, 2, 3
or: void labdis (int ndis, char *cax);
NDIS is the distance in plot coordinates.
CAX is a character string that defines the axes.
Default: (24, ’XYZ’).
LABMOD
The routine LABMOD modifies the appearance of date labels enabled with the keyword ’DATE’ in the
routine LABELS. Normally, date labels will be plotted in the form dd-mmm-yyyy.
The call is: CALL LABMOD (CKEY, CVAL, CAX) level 1, 2, 3
or: void labmod (char *ckey, char *cval, char *cax);
CKEY is a character string containing one of the following keywords:
= ’YEAR’ means that the century field will be modified in date labels. For CKEY =
’YEAR’, CVAL can have the values ’NONE’, ’SHORT’ and ’FULL’. ’NONE’
suppresses the year field while ’SHORT’ suppresses the century in the year
field. The default value is ’FULL’.
= ’DAYS’ means that the day field will be modified. CVAL can have the values ’NONE’,
’SHORT’, ’LONG’, ’NAME’ and ’FULL’. For CVAL = ’NONE’, the day field
will be suppressed, for CVAL = ’SHORT’, the day will be plotted as a number
without a leading zero. CVAL = ’LONG’ means that the day will be plotted
as a number with two digits, CVAL = ’NAME’ means that abbreviations of
the weekday names will be plotted and CVAL = ’FULL’ means that the full
weekday names will be displayed. The default value is CVAL = ’LONG’.
45
= ’MONTH’ means that the month field will be modified. CVAL can have the values
’NONE’, ’SHORT’, ’LONG’, ’NAME’, ’TINY’ and ’FULL’. For CVAL =
’NONE’, the month field will be suppressed, for CVAL = ’SHORT’, the month
will be plotted as a number without a leading zero. CVAL = ’LONG’ means
that the month will be plotted as a number with two digits, CVAL = ’NAME’
means that abbreviations of the month names will be plotted, CVAL = ’TINY’
means that only the first character of month names will be plotted and CVAL =
’FULL’ means that the full month names will be displayed. The default value
is CVAL = ’NAME’.
= ’LANG’ defines the language used for weekdays and month names in date labels. CVAL
can have the values ’ENGLISH’, ’GERMAN’ and ’SPANISH’. The default
value for CVAL is ’ENGLISH’.
= ’FORM’ defines the order of the date fields. CVAL can have the values ’DMY’, ’DYM’,
’YDM’, ’YMD’, ’DYM’ and ’MDY’. The default is CVAL = ’DMY’.
= ’SEPA’ defines a separator character used in date labels. CVAL is a character string
containing the separator character. The default is CVAL = ’-’.
= ’CASE’ defines if weekdays and month names are plotted in uppercase characters or in
lowercase characters with a leading uppercase character. CVAL can have the
values ’UPPER’ and ’NONE’. The default value is ’NONE’.
= ’STEP’ defines a step between labels. CVAL can have the values ’DAYS’, ’MONTH’,
’DMONTH’, ’QUARTER’, ’HALF’ and ’YEAR’. For CVAL = ’DAYS’, the
label step specified in the routine GRAF will be used. The default value is
CVAL = ’DAYS’.
CAX is a character string that defines the axes.
POLMOD
The routine POLMOD modifies the appearance of angle labels plotted with the routine GRAFP.
The call is: CALL POLMOD (CPOS, CDIR) level 1, 2, 3
or: void polmod (char *cpos, char *cdir);
CPOS is a character string that defines the position of the first label. CPOS can have
the values ’RIGHT’, ’TOP’, ’LEFT’ and ’BOTTOM’.
CDIR defines the direction of the labels. CDIR can have the values ’CLOCKWISE’
and ’ANTICLOCK’.
Default: (’RIGHT’, ’ANTICLOCK’).
TIMOPT
With TIMOPT time labels can be plotted in the format ’hh:mm’. The default is ’hhmm’.
RGTLAB
The routine RGTLAB right-justifies user labels. By default, user labels are left-justified.
46
6.2.6 Modifying Axis Titles
NAME
NAME defines axis titles.
HNAME
HNAME defines the character height for axis names.
NAMDIS
NAMDIS sets the distance between axis names and labels.
NAMJUS
The routine NAMJUS defines the alignment of axis titles.
CJUS is a character string that can have the values ’CENT’, ’LEFT’ and ’RIGHT’.
CAX is a character string that defines the axes.
Default: (’CENT’, ’XYZ’).
RVYNAM
The routine RVYNAM is used to plot names and labels on right Y-axes and colour bars at an angle of 90
degrees. By default, they are plotted at an angle of 270 degrees.
47
6.2.7 Suppressing Axis Parts
NOLINE
After a call to NOLINE the plotting of axis lines will be suppressed.
The call is: CALL NOLINE (CAX) level 1, 2, 3
or: void noline (char *cax);
CAX is a character string that defines the axes.
AXENDS
With a call to AXENDS certain labels can be suppressed.
The call is: CALL AXENDS (COPT, CAX) level 1, 2, 3
or: void axends (char *copt, char *cax);
COPT is a character string that defines which labels will be suppressed.
= ’NONE’ means that all labels will be displayed.
= ’FIRST’ means that only the starting label will be plotted.
= ’NOFIRST’ means that the starting label will not be plotted.
= ’LAST’ means that only the ending label will be plotted.
= ’NOLAST’ means that the ending label will not be plotted.
= ’ENDS’ means that only the start and end labels will be plotted.
= ’NOENDS’ means that start and end labels will be suppressed.
CAX is a character string that defines the axes.
Default: (’NONE’, ’XYZ’).
NOGRAF
The routine NOGRAF suppresses the plotting of an axis system.
The call is: CALL NOGRAF level 1
or: void nograf ();
AX2GRF
The routine AX2GRF suppresses the plotting of the upper X- and left Y-axis.
The call is: CALL AX2GRF level 1, 2, 3
or: void ax2grf ();
SETGRF
SETGRF removes a part of an axis or a complete axis from an axis system.
The call is: CALL SETGRF (C1, C2, C3, C4) level 1, 2, 3
or: void setgrf (char *c1, char *c2, char *c3, char *c4);
Ci are character strings corresponding to the four axes of an axis system. C1
corresponds to the lower X-axis, C2 to the left Y-axis, C3 to the upper X-
axis and C4 to the right Y-axis. The parameters can have the values ’NONE’,
’LINE’, ’TICKS’, ’LABELS’ and ’NAME’. With ’NONE’, complete axes will
be suppressed, with ’LINE’, only axis lines will be plotted, with ’TICKS’, axis
lines and ticks will be plotted, with ’LABELS’ axis lines, ticks and labels will
be plotted and with ’NAME’, all axis elements will be displayed.
Default: (’NAME’, ’NAME’, ’TICKS’, ’TICKS’).
48
Additional notes: - By default, GRAF plots a frame of thickness 1 around axis systems. There-
fore, in addition to the parameter ’NONE’, FRAME should be called with the
parameter 0 for suppressing complete axes.
- SETGRF does not reset the effect of NOGRAF and NOLINE. This must be
done using RESET.
CLPWIN
The routine CLPWIN defines a rectangular clipping area on the page.
The call is: CALL CLPWIN (NX, NY, NW, NH) level 1, 2, 3
or: void clpwin (int nx, int ny, int nw, int nh);
NX, NY are the plot coordinates of the upper left corner.
NW, NH are the width and height of the rectangle in plot coordinates.
CLPBOR
The routine CLPBOR sets the clipping area to the entire page or to the axis system.
NOCLIP
The suppressing of lines outside of the borders of an axis system can be disabled with NOCLIP.
GRACE
GRACE defines a margin around axis systems where lines will be clipped.
FRAME
FRAME defines the thickness of frames plotted by routines such as GRAF and LEGEND.
49
NFRM is the thickness of the frame in plot coordinates. If NFRM is negative, the
frame will be thickened from the inside. If positive, the frame will be thickened
towards the outside.
Default: NFRM = 1
FRMCLR
The colour of frames can be defined with the routine FRMCLR.
AXSBGD
The routine AXSBGD defines a background colour for axis systems.
NCLR is a colour value. If NCLR = -1, the background of an axis system is not filled
in GRAF.
Default: NCLR = -1
AXCLRS
AXCLRS selects colours for single parts of axes.
TITLIN
This subroutine defines up to four lines of text used for axis system titles. The text can be plotted with
TITLE after a call to GRAF.
50
N is an integer that contains a value between 1 and 4 or -1 and -4. If N is negative,
the line will be underscored.
Default: All lines are filled with blanks.
TITJUS
The routine TITJUS defines the alignment of title lines.
The call is: CALL TITJUS (CJUS) level 1, 2, 3
or: void titjus (char *cjus);
CJUS is a character string that can have the values ’CENT’, ’LEFT’ and ’RIGHT’.
Default: CJUS = ’CENT’.
LFTTIT
Title lines are centred above axis systems by default but can be left-justified with a call to LFTTIT. This
routine has the same meaning as TITJUS (’LEFT’).
The call is: CALL LFTTIT level 1, 2, 3
or: void lfttit ();
TITPOS
The routine TITPOS defines the position of title lines which can be plotted above or below axis systems.
The call is: CALL TITPOS (CPOS) level 1, 2, 3
or: void titpos (char *cpos);
CPOS is a character string that can have the values ’ABOVE’ and ’BELOW’.
Default: CPOS = ’ABOVE’.
LINESP
LINESP defines the spacing between title and legend lines.
The call is: CALL LINESP (XFAC) level 1, 2, 3
or: void linesp (float xfac);
XFAC The space between lines is set to XFAC * character height.
Default: XFAC = 1.5
HTITLE
HTITLE defines the character height for titles. The character height defined by HEIGHT will be used if
HTITLE is not called.
The call is: CALL HTITLE (NHCHAR) level 1, 2, 3
or: void htitle (int nhchar);
NHCHAR is the character height in plot coordinates.
VKYTIT
The space between titles and axis systems can be enlarged or reduced with VKYTIT. By default, the
space is 2 * character height.
The call is: CALL VKYTIT (NV) level 1, 2, 3
or: void vkytit (int nv);
NV is an integer that determines the spacing between axis systems and titles. If
NV is negative, the space will be reduced by NV plot coordinates. If NV is
positive, the space will be enlarged by NV plot coordinates.
Default: NV = 0
51
6.3 Colours
This paragraph describes routines that modify colours. A colour value in DISLIN may be an entry of the
current colour table, or an explicit RGB value. When specifying an explicit RGB value, the colour value
must have the following hexadecimal form: 01bbggrr. The low-order byte contains the intensity of red,
the second byte the intensity of green and the third byte the intensity of blue. The high-order byte must
have the value 1. The function INTRGB creates an explicit RGB value from RGB coordinates. If the
output device can only display 256 colours and an explicit RGB value is given, the nearest entry in the
current colour table that matches the RGB coordinates will be used. Some routines define colours also
by name such as COLOR, or by RGB coordinates such as SETRGB.
COLOR
COLOR defines the colours used for plotting text and lines.
CNAME is a character string that can have the values ’BLACK’, ’RED’, ’GREEN’,
’BLUE’, ’CYAN’, ’YELLOW’, ’ORANGE’, ’MAGENTA’, ’WHITE’, ’FO-
RE’ and ’BACK’. The keyword ’FORE’ resets the color to the default value,
while the keyword ’BACK’ sets the colour to the background colour.
Additional note: The values ’BLACK’ and ’WHITE’ define not absolute colours. If the output
format is in reverse mode, ’BLACK’ is interpreted as ’WHITE’ and ’WHITE’
is interpreted as ’BLACK’. If you want to use true black and true white, you
can use the routine SETRGB (0., 0., 0.) and SETRGB (1., .1., 1.).
SETCLR
The routine SETCLR sets the foreground colour where the colour can be specified as a colour table entry
or as an explicit RGB colour.
SETRGB
The routine SETRGB defines the foreground colour specified in RGB coordinates.
XR, XG, XB are the RGB coordinates of a colour in the range 0 to 1. If the output device
cannot display true colours, SETRGB sets the nearest entry in the colour table
that matches the RGB coordinates.
52
6.3.2 Modifying Colour Tables
SETVLT
SETVLT selects a colour table.
MYVLT
The routine MYVLT changes the current colour table.
SETIND
The routine SETIND allows the user to change the current colour table.
The call is: CALL SETIND (INDEX, XR, XG, XB) level 1, 2, 3
or: void setind (int index, float xr, float xg, float xb);
INDEX is an index between 0 and 255.
XR, XG, XB are the RGB coordinates of a colour in the range 0 to 1.
VLTFIL
The routine VLTFIL saves the current colour table to a file, or loads a colour table from a file.
53
6.3.3 Utitily Routines for Colours
INTRGB
The function INTRGB creates an explicit colour value from RGB coordinates.
INDRGB
The function INDRGB returns the nearest entry in the current colour table that matches given RGB
coordinates.
Sometimes, it is easier to specify colours as HSV coordinates where H is the hue, S the saturation and V
the value of a colour. The following routines convert coordinates from the HSV to the RGB model and
vice versa.
HSVRGB
The routine HSVRGB converts HSV coordinates to RGB coordinates.
The call is: CALL HSVRGB (XH, XS, XV, XR, XG, XB) level 1, 2, 3
or: void hsvrgb (float xh, float xs, float xv, float *xr, float *xg, float *xb);
XH, XS, XV are the hue, saturation and value of a colour. XH must be in the range 0 to 360
degrees while XS and XV can have values between 0 and 1. In the HSV model,
colours lie in a spectral order on a six-sided pyramid where red corresponds to
the angle 0, green to 120 and blue to 240 degrees.
XR, XG, XB are the RGB coordinates in the range 0 to 1 calculated by HSVRGB.
RGBHSV
The routine RGBHSV converts RGB coordinates to HSV coordinates.
The call is: CALL RGBHSV (XR, XG, XB, XH, XS, XV) level 1, 2, 3
or: void rgbhsv (float xr, float xg, float xb, float *xh, float *xs, float *xv);
54
NHCHAR is the character height in plot coordinates.
Default: NHCHAR = 36
ANGLE
This routine modifies the direction of text plotted with the routines MESSAG, NUMBER, RLMESS and
RLNUMB.
TXTJUS
The routine TXTJUS defines the alignment of text plotted with the routines MESSAG and NUMBER.
The call is: CALL TXTJUS (CJUS) level 1, 2, 3
or: void txtjus (char *cjus);
CJUS is a character string that can have the values ’LEFT’, ’RIGHT’ and ’CENT’.
The starting point of text and numbers will be interpreted as upper left, upper
right and upper centre point.
Default: CJUS = ’LEFT’.
FRMESS
FRMESS defines the thickness of frames around text plotted by MESSAG.
NUMFMT
NUMFMT modifies the format of numbers plotted by NUMBER and RLNUMB.
NUMODE
NUMODE alters the appearance of numbers plotted by NUMBER and RLNUMB.
55
The call is: CALL NUMODE (CDEC, CGRP, CPOS, CFIX) level 1, 2, 3
or: void numode (char *cdec, char *cgrp, char *cpos, char *cfix);
CDEC is a character string that defines the decimal notation.
= ’POINT’ defines a point.
= ’COMMA’ defines a comma.
CGRP is a character string that defines the grouping of 3 digits.
= ’NONE’ means no grouping.
= ’SPACE’ defines a space as separator.
= ’POINT’ defines a point as separator.
= ’COMMA’ defines a comma as separator.
CPOS is a character string that defines the sign preceding positive numbers.
= ’NONE’ means no preceding sign.
= ’SPACE’ defines a space as a preceding sign.
= ’PLUS’ defines a plus as a preceding sign.
CFIX is a character string specifying character spacing.
= ’NOEQUAL’ is used for proportional spacing.
= ’EQUAL’ is used for non-proportional spacing.
Default: (’POINT’,’NONE’,’NONE’,’NOEQUAL’).
CHASPC
CHASPC affects intercharacter spacing.
CHAWTH
CHAWTH affects the width of characters.
CHAANG
CHAANG defines an inclination angle for characters.
56
ANGLE is the inclination angle between characters and the vertical direction in degrees
(-60. ≤ ANGLE ≤60).
Default: ANGLE = 0.
FIXSPC
All fonts in DISLIN except for the default font are proportional. After a call to FIXSPC the characters
of a proportional font will also be plotted with a constant character width.
6.5 Fonts
The following routines define character sets of varying style and plot velocity. All fonts except for the
default font DISALF are proportional. Each font provides 6 alphabets.
The calls are: CALL DISALF - default font, single stroke, low resolution
CALL SIMPLX - single stroke font
CALL COMPLX - complex font
CALL DUPLX - double stroke font
CALL TRIPLX - triple stroke font
CALL GOTHIC - gothic font
CALL SERIF - complex shaded font
CALL HELVE - shaded font
CALL HELVES - shaded font with small characters
Additional note: If one of the shaded fonts SERIF, HELVE or HELVES is used, only the outlines
of characters are plotted to minimize plotting time. With the statement CALL
SHDCHA characters will be shaded.
PSFONT
PSFONT defines a PostScript font.
The call is: CALL PSFONT (CFONT) level 1, 2, 3
or: void psfont (char *cfont);
CFONT is a character string containing the font. Standard font names in PostScript are:
Times-Roman Courier
Times-Bold Courier-Bold
Times-Italic Courier-Oblique
Times-BoldItalic Courier-BoldOblique
Helvetica AvantGarde-Book
57
Helvetica-Bold AvantGarde-Demi
Helvetica-Oblique AvantGarde-BookOblique
Helvetica-BoldOblique AvantGarde-DemiOblique
Helvetica-Narrow Bookman-Light
Helvetica-Narrow-Bold Bookman-LightItalic
Helvetica-Narrow-Oblique Bookman-Demi
Helvetica-Narrow-BoldOblique Bookman-DemiItalic
NewCenturySchlbk-Roman Palatino-Roman
NewCenturySchlbk-Italic Palatino-Italic
NewCenturySchlbk-Bold Palatino-Bold
NewCenturySchlbk-BoldItalic Palatino-BoldItalic
ZapfChancery-MediumItalic Symbol
ZapfDingbats
Additional notes: - The file format must be set to ’PS’, ’EPS’, ’PDF’ or ’SVG’ with the routine
METAFL. For SVG files, the Times, Helvetica and Courier fonts can be used.
- Font names cannot be shortened. Some printers provide additional non-
standard fonts. These fonts should be specified exactly in upper and lower
characters as they are described in the printer manuals. PostScript suppresses
any graphics if there is a syntax error in the font name. Standard font names
are not case-sensitive.
- A call to a DISLIN font resets PostScript fonts.
- The character coding defined with CHACOD should be ’STANDARD’ or
’ISO1’ for PostScript fonts. Otherwise, the DISLIN font ’COMPLX’ is used.
WINFNT
WINFNT defines a TrueType font for WMF files and screen output on Windows displays.
The call is: CALL WINFNT (CFONT) level 1, 2, 3
or: void winfnt (char *cfont);
CFONT is a character string containing the font. The following fonts can normally be
used on the Windows 9x/NT/2000 operating system:
Additional note: - The coding of a Windows font should correspond to the character coding de-
fined with CHACOD. For example, if the character coding in CHACOD is set
to ’STANDARD’ or ’ISO1’, an ISO-Latin-1 should be used. If the character
coding is set to ’UTF8’, an Unicode font should be loaded.
X11FNT
X11FNT defines an X11 font for screen output on X11 displays.
The call is: CALL X11FNT (CFONT, COPT) level 1, 2, 3
or: void x11fnt (char *cfont, char *copt);
CFONT is a character string containing the first part of an X11 font.
58
COPT is a character string containing the last part of an X11 font. IF COPT = ’STAN-
DARD’, the value ’-*-*-*-*-iso8859-1’ is used for the last part of an X11 font.
Additional notes: - CFONT must begin and end with the separator ’-’ and must contain the first
five fields of an X11 font. DISLIN adds then the point size and a transfor-
mation matrix to the font. IF COPT has not the value ’STANDARD’, it must
begin with the character ’-’ and contain the last 6 fields of an X11 font.
- The coding of the X11 font should correspond to the coding defined with CHA-
COD (see WINFNT).
-Adobe-Times-Medium-R-Normal-
-Adobe-Times-Bold-R-Normal-
-Adobe-Times-Bold-I-Normal-
-Adobe-Helvetica-Bold-R-Normal-
-Adobe-Courier-Medium-R-Normal-
BMPFNT
DISLIN contains some bitmap fonts that can be set with the routine BMPFNT. Bitmap fonts are allowed
for screen output and for a bitmap file format. They can be used to increase the quality of directly created
raster formats such as PNG and TIFF.
CFONT is a character string that can have the values ’COMPLEX’, ’SIMPLEX’ and
’HELVE’. The DISLIN bitmap fonts contain characters for ’STANDARD’,
’ISO1’, ’ISO2’ and ’ISO3’ codings.
HWFONT
The routine HWFONT sets a standard hardware font if hardware fonts are supported by the current file
format. For example, if the file format is PostScript, the font ’Times-Roman’ is used, if the file format is
’CONS’ or ’XWIN’, ’Times New Roman’ is used for Windows and ’-*-Times-Bold-R-Normal-’ is used
for X11. If no hardware fonts are supported, COMPLX is used.
CHACOD
The routine CHACOD defines the coding of characters.
COPT is a character string that can have the values ’STANDARD’, ’ISO1’, ’ISO2’,
’ISO3’, ’ISO5’, ’ISO7’, ’KOI8’ and ’UTF8’. The keyword ’STANDARD’
means the DISLIN coding of characters as displayed in the figures 6.4 to 6.10.
’ISO5’ and ’KOI8’ are encodings for Cyrillic characters while ’ISO7’ is a
coding for Greek characters. ’UTF8’ is a coding for Unicode characters. If
COPT is not ’STANDARD’, the coding is mapped to the available DISLIN
characters.
Default: ’STANDARD’.
59
BASALF
BASALF defines the base alphabet.
SMXALF
SMXALF defines shift characters to shift between the base and an alternate alphabet.
PSMODE
The routine PSMODE sets PostScript options.
EUSHFT
European characters can be plotted by using their character codes in text strings where different character
codings are available (see CHACOD), or by defining a shift character that converts the following char-
acter into a European character. The routine EUSHFT defines shift characters for European characters.
60
CSHIFT is a shift character. The character placed directly after CSHIFT will be plotted
as the corresponding European character. Figure 6.3 shows a table of the
possible European characters.
Additional notes: - Shift characters can be defined multiple where the characters must be different.
- The Turkish characters are only supported by COMPLX and by the bitmap
fonts defined with BITMAP. The other European characters are also supported
by PostScript.
- If the shift characters should be plotted in a text string, they must be doubled.
- European characters are not available for the character codings ’ISO5’, ’ISO7’
and ’KOI8’.
The following table shows all possible European characters. The characters on the left side of a column
are shifted to the characters on the right side of that column:
A Ä A Å N Ñ C Ç A Á A À A Â
O Ö O Ø n ñ c ç E É E È E Ê
U Ü E Æ ! ¡ E Ë I Í I Ì I Î
a ä a å ? ¿ I Ï O Ó O Ò O Ô
o ö o ø e ë U Ú U Ù U Û
u ü e æ i ï a á a à a â
s ß e é e è e ê
i í i ì i î
o ó o ò o ô
u ú u ù u û
Example:
PROGRAM EUSHFT
CALL METAFL (’CONS’)
CALL DISINI
CALL PAGERA
CALL HWFONT
The next figures show several software and PostScript fonts that can be used in DISLIN. The full set
of special European characters (ASCII code > 126) is available in the software font COMPLX and in
PostScript, X11 and TrueType fonts. The coding of the characters in figure 6.10 is the default char-
acter coding in DISLIN. An ISO-Latin-1 coding of characters can be defined with the DISLIN routine
CHACOD.
61
ASCII STAN. ITAL. GREEK ASCII STAN. ITAL. GREEK ASCII STAN. ITAL. GREEK
32 66 100
33 67 101
34 68 102
35 69 103
36 70 104
37 71 105
38 72 106
39 73 107
40 74 108
41 75 109
42 76 110
43 77 111
44 78 112
45 79 113
46 80 114
47 81 115
48 82 116
49 83 117
50 84 118
51 85 119
52 86 120
53 87 121
54 88 122
55 89 123
56 90 124
57 91 125
58 92 126
59 93 127
60 94 128
61 95 129
62 96 130
63 97 131
64 98 132
65 99 133
62
ASCII STAN. ITAL. GREEK ASCII STAN. ITAL. GREEK ASCII STAN. ITAL. GREEK
32 66 100
33 67 101
34 68 102
35 69 103
36 70 104
37 71 105
38 72 106
39 73 107
40 74 108
41 75 109
42 76 110
43 77 111
44 78 112
45 79 113
46 80 114
47 81 115
48 82 116
49 83 117
50 84 118
51 85 119
52 86 120
53 87 121
54 88 122
55 89 123
56 90 124
57 91 125
58 92 126
59 93 127
60 94 128
61 95 129
62 96 130
63 97 131
64 98 132
65 99 133
63
ASCII STAN. ITAL. GREEK ASCII STAN. ITAL. GREEK ASCII STAN. ITAL. GREEK
32 66 100
33 67 101
34 68 102
35 69 103
36 70 104
37 71 105
38 72 106
39 73 107
40 74 108
41 75 109
42 76 110
43 77 111
44 78 112
45 79 113
46 80 114
47 81 115
48 82 116
49 83 117
50 84 118
51 85 119
52 86 120
53 87 121
54 88 122
55 89 123
56 90 124
57 91 125
58 92 126
59 93 127
60 94 128
61 95 129
62 96 130
63 97 131
64 98 132
65 99 133
64
ASCII SCRI. RUSS. MATH. ASCII SCRI. RUSS. MATH. ASCII SCRI. RUSS. MATH.
32 66 100
33 67 101
34 68 102
35 69 103
36 70 104
37 71 105
38 72 106
39 73 107
40 74 108
41 75 109
42 76 110
43 77 111
44 78 112
45 79 113
46 80 114
47 81 115
48 82 116
49 83 117
50 84 118
51 85 119
52 86 120
53 87 121
54 88 122
55 89 123
56 90 124
57 91 125
58 92 126
59 93 127
60 94 128
61 95 129
62 96 130
63 97 131
64 98 132
65 99 133
65
ASCII STAN. ITAL. SCRI. ASCII STAN. ITAL. SCRI. ASCII STAN. ITAL. SCRI.
32 66 100
33 67 101
34 68 102
35 69 103
36 70 104
37 71 105
38 72 106
39 73 107
40 74 108
41 75 109
42 76 110
43 77 111
44 78 112
45 79 113
46 80 114
47 81 115
48 82 116
49 83 117
50 84 118
51 85 119
52 86 120
53 87 121
54 88 122
55 89 123
56 90 124
57 91 125
58 92 126
59 93 127
60 94 128
61 95 129
62 96 130
63 97 131
64 98 132
65 99 133
66
ASCII STAN. ITAL. GREEK ASCII STAN. ITAL. GREEK ASCII STAN. ITAL. GREEK
32 66 100
33 67 101
34 68 102
35 69 103
36 70 104
37 71 105
38 72 106
39 73 107
40 74 108
41 75 109
42 76 110
43 77 111
44 78 112
45 79 113
46 80 114
47 81 115
48 82 116
49 83 117
50 84 118
51 85 119
52 86 120
53 87 121
54 88 122
55 89 123
56 90 124
57 91 125
58 92 126
59 93 127
60 94 128
61 95 129
62 96 130
63 97 131
64 98 132
65 99 133
67
Times-Roman
ASCII CHAR ASCII CHAR ASCII CHAR ASCII CHAR ASCII CHAR
32 63 ? 94 ^ 125 } 156 ó
33 ! 64 @ 95 _ 126 ~ 157 ú
34 " 65 A 96 ‘ 127 Ä 158 À
35 # 66 B 97 a 128 Ö 159 È
36 $ 67 C 98 b 129 Ü 160 Ì
37 % 68 D 99 c 130 ä 161 Ò
38 & 69 E 100 d 131 ö 162 Ù
39 ’ 70 F 101 e 132 ü 163 à
40 ( 71 G 102 f 133 ß 164 è
41 ) 72 H 103 g 134 Å 165 ì
42 * 73 I 104 h 135 Ø 166 ò
43 + 74 J 105 i 136 Æ 167 ù
44 , 75 K 106 j 137 å 168 Â
45 - 76 L 107 k 138 ø 169 Ê
46 . 77 M 108 l 139 æ 170 Î
47 / 78 N 109 m 140 Ñ 171 Ô
48 0 79 O 110 n 141 ñ 172 Û
49 1 80 P 111 o 142 Ç 173 â
50 2 81 Q 112 p 143 ç 174 ê
51 3 82 R 113 q 144 Ë 175 î
52 4 83 S 114 r 145 Ï 176 ô
53 5 84 T 115 s 146 ë 177 û
54 6 85 U 116 t 147 ï 178 Ã
55 7 86 V 117 u 148 Á 179 ã
56 8 87 W 118 v 149 É 180 Õ
57 9 88 X 119 w 150 Í 181 õ
58 : 89 Y 120 x 151 Ó 182 Ý
59 ; 90 Z 121 y 152 Ú 183 ý
60 < 91 [ 122 z 153 á 184 ÿ
61 = 92 \ 123 { 154 é 185 ¡
62 > 93 ] 124 | 155 í 186 ¿
68
PostScript Fonts
This is Times-Roman
This is Times-Bold
This is Times-Italic
This is Times-BoldItalic
This is Helvetica
This is Helvetica-Bold
This is Helvetica-Oblique
This is Helvetica-BoldOblique
This is Helvetica-Narrow
This is Helvetica-Narrow-Bold
This is Helvetica-Narrow-Oblique
This is Helvetica-Narrow-BoldOblique
This is NewCenturySchlbk-Roman
This is NewCenturySchlbk-Italic
This is NewCenturySchlbk-Bold
This is NewCenturySchlbk-BoldItalic
This is ZapfChancery-MediumItalic
❁▼▲
This is Courier
This is Courier-Bold
This is Courier-Oblique
This is Courier-BoldOblique
This is AvantGarde-Book
This is AvantGarde-Demi
This is AvantGarde-BookOblique
This is AvantGarde-DemiOblique
This is Bookman-Light
This is Bookman-LightItalic
This is Bookman-Demi
This is Bookman-DemiItalic
This is Palatino-Roman
This is Palatino-Italic
This is Palatino-Bold
This is Palatino-BoldItalic
Τηισ ισ Σψµβολ
69
6.6 Indices and Exponents
Indices and exponents can be plotted by using control characters in characters strings, or by using the
TeX syntax described in paragraph 6.7. There are 3 predefined control characters in DISLIN which can
be altered with the routines NEWMIX and SETMIX. The predefined character
[ is used for exponents. The character height is reduced by the scaling factor FEXP and the
pen is moved up FBAS * NH plot coordinates where NH is the current character height.
] is used for indices. The pen is moved down FBAS * NH plot coordinates and the character
height is reduced by the scaling factor FEXP.
$ is used to move the pen back to the base-line. This will automatically be done at the end of
a character string.
FBAS and FEXP have the default values 0.6 and 0.8, respectively, these values can be changed with the
routines SETBAS and SETEXP.
MIXALF
This routine instructs DISLIN to search for control characters in character strings.
SETBAS
SETBAS defines the position of indices and exponents. This routine also affects logarithmic axis labels.
SETEXP
SETEXP sets the character height of indices and exponents.
The call is: CALL SETEXP (FEXP) level 1, 2, 3
or: void setexp (float fexp);
FEXP is a real number used as a scaling factor. The character height of indices and
exponents is set to FEXP * NH where NH is the current character height.
Default: FEXP = 0.8
NEWMIX
NEWMIX defines an alternate set of control characters for plotting indices and exponents. The default
characters ’[’, ’]’ and ’$’ are replaced by ’ˆ’, ’ ’ and ’%’.
The call is: CALL NEWMIX level 1, 2, 3
or: void newmix ();
SETMIX
SETMIX defines global control characters for plotting indices and exponents.
70
The call is: CALL SETMIX (C, CMIX) level 1, 2, 3
or: void setmix (char *c, char *cmix);
C is a new control character.
CMIX is a character string that defines the function of the control character. CMIX
can have the values ’EXP’, ’IND’, ’RES’, ’LEG’ and ’TEX’ for exponents,
indices, resetting the base-line, for multiple text lines in legends and for TeX
instructions, respectively.
Additional note: The routines NEWMIX and SETMIX only modify the control characters. A
call to MIXALF is always necessary to plot indices and exponents.
71
Command Parameter Default Description
For the following examples, the characters ’{’ and ’}’ are defined with CALL SMXALF (’INST’, ’{’,
’}’, 1) to switch between the instruction and the base alphabet.
72
Figure 6.12: Instruction Alphabet
73
6.8 TeX Instructions for Mathematical Formulas
6.8.1 Introduction
This paragraph presents an alternate method to the DISLIN instruction alphabet for plotting mathemat-
ical formulas. The text formatting language TeX has a very easy method for describing mathematical
formulas. Since this method is well-known by many scientists, an emulation mode for TeX instructions
is added to DISLIN with version 7.4.
TeX instructions can be enabled in DISLIN with the statement CALL TEXMOD (’ON’). If TeX mode
is enabled, mixed alphabets defined with SMXALF and the control characters for indices and exponents
described in paragraph 6.5 will be ignored.
Mathematical formulas in TeX mode are produced in DISLIN by some special descriptive text. This
means that DISLIN must be informed that the following text is to be interpreted as a mathematical
formula. The character $ in a text switches from text to math mode, and from math to text mode.
Therefore, mathematical formulas must be enclosed in a pair of dollar signs.
Numbers that appear within formulas are called constants, whereas simple variables are represented by
single letters. The universal practice in mathematical typesetting is to put constants in Roman typeface
and variables in italics. DISLIN uses this rule by default in math mode. The rule can be modified with
the routine TEXOPT. Blanks are totally ignored in math mode and spaces are included automatically by
DISLIN between constants, variables and operators.
The characters $, {, } and \ have a special meaning in TeX mode and therefore cannot act as printable
characters. To include them in normal text, the commands \$, \{, \} and \\ must be used. Additional,
the characters and ˆ have a special meaning in math mode and can be handled in the same way.
Note: Some Fortran compilers treat the character ’\’ as a special control character, so that an
additional flag has to be used for compiling (i.e. -fno-backslash for g77), or the TeX control
character ’\’ can be replaced by another character with the routine SETMIX.
74
TEXVAL
The routine TEXVAL sets a factor for the size of indices and exponents.
Additional note: The commands ˆ and are only allowed in math mode.
6.8.4 Fractions
The instruction \frac{numerator}{denominator} can be used in TeX math mode for plotting fractions.
The numerator is plotted on top of the denominator with a horizontal fraction line between them.
1
\frac{1}{x+y}
x+y
a2 − b2
=a−b \frac{aˆ2 - bˆ2}{a+b} = a - b
a+b
Fractions may be nested to a depth of 8 within one another:
a b
x−y +x+y
a−b
\frac{\frac{a}{x-y} + \frac{b}{x+y}
1+ a+b
{1 + \frac{a-b}{a+b}}
6.8.5 Roots
Roots can be plotted with the syntax \sqrt[n]{arg} where the optional part [n] can be omitted.
Examples:
√3
8=2 \sqrt[3]{8} = 2
p
x2 + y 2 + 2xy = x + y \sqrt{xˆ2 + yˆ2 + 2xy} = x + y
75
6.8.6 Sums and Integrals
Summation and integral signs can be plotted with the two instructions \sum and \int. Sums and integrals
can posses upper and lower limits that can be plotted with the exponent and index instructions ˆ and . By
default, the limits are placed below and above the summation and integral signs. This can be modfified
with the routine TEXMOD or with the instruction \nolimits following the summation and integral signs.
Examples:
n
\sum {i=1}ˆn a i
P
2 ai
i=0
Rb
a fi (x)gi (x)dx \int\nolimits aˆb f i(x)g i(x)dx
76
6.8.10 Function Names
The standard for mathematical formulas is to set variable names in italics but the names of functions in
Roman. The following function names will be recognized by DISLIN and plotted in Roman.
6.8.11 Accents
Accents are available in TeX mode in the same way as in normal DISLIN mode (see EUSHFT).
6.8.16 Example
PROGRAM EX6_2
CHARACTER CSTR*80
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
77
CALL HEIGHT(40)
CALL TEXMOD(’ON’)
CALL MESSAG(’$\frac{1}{x+y}$’, 150, 400)
CALL MESSAG(’$\frac{aˆ2 - bˆ2}{a+b} = a - b$’, 1200, 400)
78
Figure 6.13: TeX Instructions for Mathematical Formulas
79
6.9 Curve Attributes
CHNCRV
CHNCRV defines attributes that will be automatically changed by CURVE after a certain number of calls
to the routine CURVE.
The following three routines are useful when automatic attribute setting is selected and the routine
CURVE is called several times to plot a single curve.
INCCRV
INCCRV defines the number of calls after which CURVE will automatically change attributes.
CHNATT
CHNATT is an alternative routine to INCCRV. It is useful when the number of curves plotted with
identical attributes varies. CHNATT defines new attributes that will be used by CURVE during the next
call.
RESATT
In general, curve attributes will be repeated after 8 changes. With the routine RESATT, the attributes can
be reset earlier.
80
INCMRK
INCMRK selects line or symbol mode for CURVE.
MARKER
The symbols used to plot points can be selected with the routine MARKER. The symbol number will be
incremented by 1 after a certain number of calls to CURVE defined by INCCRV.
HSYMBL
HSYMBL defines the size of symbols.
MYSYMB
MYSYMB sets an user-defined symbol.
The call is: CALL MYSYMB (XRAY, YRAY, N, ISYM, IFLAG) level 1, 2, 3
or: void mysymb (float *xray, float *yray, int n, int isym, int iflag);
XRAY, YRAY are the X- and Y-coordinates of the symbol in the range -1 and 1.
N is the number of coordinates in XRAY and YRAY.
ISYM is a non negative number that will be used as symbol number.
IFLAG is an Integer that can have the values 0 and 1. If IFLAG = 1, the symbol will
be filled.
Additional note: The number of points in MYSYMB is limited to 100 for Fortran 77. There is
no limitation for the C and Fortran 90 versions of DISLIN.
THKCRV
THKCRV defines the thickness of curves.
81
NTHK is the thickness of curves in plot coordinates.
Default: NTHK = 1
GAPCRV
GAPCRV defines a data gap used in the routine CURVE. If the distance between two neightbouring X
coordinates is greater than the gap value, CURVE will not connect these data points.
POLCRV
POLCRV defines an interpolation method used by CURVE to connect points.
The call is: CALL POLCRV (CPOL) level 1, 2, 3
or: void polcrv (char *cpol);
CPOL is a character string containing the interpolation method.
= ’LINEAR’ defines linear interpolation.
= ’STEP’ defines step interpolation.
= ’STAIRS’ defines step interpolation.
= ’BARS’ defines bar interpolation.
= ’FBARS’ defines filled bar interpolation.
= ’STEM’ defines stem interpolation.
= ’SPLINE’ defines spline interpolation.
= ’PSPLINE’ defines parametric spline interpolation.
Default: CPOL = ’LINEAR’.
Additional notes: - The width of bars can be set with BARWTH.
- For spline interpolation, the X-coordinates must have different values and be
in ascending order. There is no restriction for a parametric spline. The order
of spline polynomials and the number of interpolated points can be modified
with SPLMOD.
- The interpolation medthods ’LINEAR’, ’BARS’, ’FBARS’ and ’STEM’ can
also be used for polar scaling.
SPLMOD
SPLMOD defines the order of polynomials and the number of interpolated points used for the interpola-
tion methods ’SPLINE’ and ’PSPLINE’.
82
BARWTH
BARWTH sets the width of bars plotted by CURVE.
NOCHEK
The routine NOCHEK can be used to suppress the listing of points that lie outside of the axis scaling.
The routines SOLID, DOT, DASH, CHNDSH, CHNDOT, DASHM, DOTL and DASHL define different
line styles. They are called without parameters. The routine LINTYP (NTYP) can also be used to set
line styles where NTYP is an integer between 0 and 7 and corresponds to the line styles above. The
routine MYLINE sets user-defined line styles.
MYLINE
MYLINE defines a global line style.
83
LINWID
The routine LINWID sets the line width.
Additional note: To define smaller line widhts than 1 (i.e. for PostScript files), the routine
PENWID (XWIDTH) can be used where XWIDTH has the same meaning
as NWIDTH.
LNCAP
The routine LNCAP sets the current line cap parameter.
LNJOIN
The routine LNJOIN sets the current line join parameter.
LNMLT
The routine LNMLT sets the current miter limit parameter. This routine can be useful if the line join is
set to ’SHARP’.
XFC is a floatingpoint number where XFC * line width will be used as the miter
limit. The miter length is the distance between the inner and outside edge of a
path corner.
Default: XFC = 2.
84
6.11 Shading
SHDPAT
SHDPAT selects shading patterns used by routines such as SHDCRV and AREAF.
The call is: CALL SHDPAT (IPAT) level 1, 2, 3
or: void shdpat (long ipat);
IPAT is an integer between 0 and 17. The predefined patterns are shown in appendix
C.
MYPAT
MYPAT defines a global shading pattern.
The call is: CALL MYPAT (IANGLE, ITYPE, IDENS, ICROSS) level 1, 2, 3
or: void mypat (int iangle, int itype, int idens, int icross);
IDENS defines the distance between shading lines (0: small distance, 9: big distance).
ICROSS indicates whether shading lines are hatched (0: not hatched, 1: hatched).
Examples: The following calls to MYPAT show the predefined shading patterns used by
SHDPAT:
85
NOARLN
With the routine NOARLN the outlines of shaded regions can be suppressed.
Line styles: SOLID, DOT, DASH, CHNDSH, CHNDOT, DASHM, DOTL and DASHL.
Colours: WHITE/BLACK, RED, GREEN, YELLOW, BLUE, ORANGE, CYAN and MAGENTA.
Shading: Pattern numbers from 0 to 17.
LINCYC
LINCYC changes the line style cycle.
CLRCYC
CLRCYC changes the colour cycle.
PATCYC
PATCYC changes the shading pattern cycle.
86
6.13 Base Transformations
The following subroutines create a transformation matrix that affects plot vectors contained within page
borders. Vectors may be scaled, shifted and rotated and the transformations can be combined in any
order.
TRFSHF
TRFSHF affects the shifting of plot vectors.
The call is: CALL TRFSHF (NXSHFT, NYSHFT) level 1, 2, 3
or: void trfshf (int nxshft, int nyshft);
NXSHFT, NYSHFT are plot coordinates that define the magnitude of shifting in the X- and Y-
direction.
TRFSCL
TRFSCL affects the scaling of plot vectors.
The call is: CALL TRFSCL (XSCL, YSCL) level 1, 2, 3
or: void trfscl (float xscl, float yscl);
XSCL, YSCL are scaling factors for the X- and Y-direction.
TRFROT
TRFROT affects the rotation of plot vectors around a point.
The call is: CALL TRFROT (XANG, NX, NY) level 1, 2, 3
or: void trfrot (float xang, int nx, int ny);
XANG is the rotation angle measured in degrees in a counter-clockwise direction.
NX, NY are the plot coordinates of the rotation point.
TRFRES
TRFRES resets base transformations.
The call is: CALL TRFRES level 1, 2, 3
or: void trfres ();
SHIELD
SHIELD selects shielded regions which are set automatically by DISLIN.
87
= ’PIE’ will shield pie segments plotted by PIEGRF.
= ’LEGEND’ will protect legends. All legend attributes should be set before calling CURVE
because the shielded region of a legend is defined by CURVE. If there is no
legend position defined with LEGPOS, CURVE assumes that the legend lies
in the upper right corner of the axis system.
CMODE is a character string defining a status:
= ’ON’ means that the regions defined above will be written to the shielding buffer and
are protected.
= ’OFF’ means that regions will not be written to the shielding buffer. Regions that are
still stored in the buffer will be shielded.
= ’DELETE’ removes regions from the shielding buffer.
= ’RESET’ is a combination of ’OFF’ and ’DELETE’. Regions are removed from and will
not be written to the shielding buffer. To save computing time, this command
should always be used when shielding is no longer needed.
= ’NOVIS’ The shielding of regions held in the shielding buffer is disabled. This is not
valid for regions newly written to the buffer.
= ’VIS’ Disabled regions will be protected. This is the default value for regions newly
written to the buffer.
The calls are: CALL SHLREC (NX, NY, NW, NH) for rectangles
CALL SHLRCT (NX, NY, NW, NH, THETA) for rotated rectangles
CALL SHLCIR (NX, NY, NR) for circles
CALL SHLELL (NX, NY, NA, NB, THETA) for rotated ellipses
CALL SHLPIE (NX, NY, NR, ALPHA, BETA) for pie segments
CALL SHLPOL (NXRAY, NYRAY, N) for polygons.
NX, NY are plot coordinates of the upper left corner or the centre point.
NW, NH are the width and height of rectangles.
NR, NA, NB are radii in plot coordinates.
THETA is a rotation angle measured in degrees in a counter-clockwise direction.
ALPHA, BETA are starting and ending angles for pie segments measured in degrees in a
counter-clockwise direction.
NXRAY, NYRAY are arrays of the dimension N containing the corner points of a polygon.
SHLIND
The index of shielded regions in the buffer can be requested with SHLIND. It returns the index of the
region last written to the buffer.
The call is: CALL SHLIND (ID) level 1, 2, 3
or: int shlind ();
ID is the returned index.
SHLDEL
SHLDEL removes entries from the shielding buffer.
88
or: void shldel (int id);
ID is the index of a shielded region. If ID is 0, all regions defined by the user will
be deleted.
SHLRES
SHLRES deletes regions last written to the shielding buffer.
SHLVIS
SHLVIS disables or enables shielded regions. Disabled regions are no longer protected but are still held
in the shielding buffer.
Additional notes: - A frame is plotted around regions defined by the user. The thickness of frames
can be set with FRAME. Regions defined automatically by DISLIN are not
enclosed by a frame but frames plotted by MESSAG after using FRMESS and
shielded regions defined by MESSAG are identical.
- Shielded regions can overlap each other.
- The statement CALL RESET (’SHIELD’) resets shielding. All regions defined
by DISLIN and the user are removed from the shielding buffer and no new
regions will be written to the buffer.
- The number of shielded regions is limited to the size of the shielding buffer
which is set to 1000 words. The number of words used by regions are:
SHLREC = 6, SHLRCT = 7, SHLCIR = 5, SHLELL = 7, SHLPIE = 7 and
SHLPOL = 2*N+3.
- Shielding of regions is computer intensive. Therefore, shielding should be used
very carefully and shielded regions should be deleted from the buffer when no
longer needed.
- Base transformations do not affect the position of shielded regions.
- SHLPOL can be used between the routines GRFINI and GRFFIN. The
shielded region will be projected into 3-D space. This is not valid for other
shielded regions.
89
90
Chapter 7
This chapter describes subroutines that return the current values of plot parameters. All routines corre-
spond to parameter setting routines described in the last chapter or handled in chapter 11, ”3-D Colour
Graphics”. For a complete description of parameters, the user is referred to these chapters. If a character
string is returned, it will appear in uppercase letters and be shortened to four characters. For the language
C, if the value of a requesting routine is a character pointer, the pointer is the address of a static variable
in DISLIN and may not be freed.
GETPAG
This routine returns the page size (see SETPAG, PAGE).
GETFIL
The routine GETFIL returns the current plotfile name (see SETFIL).
GETMFL
GETMFL returns the file format (see METAFL).
GETOR
GETOR returns the coordinates of the origin (see ORIGIN).
GETPOS
This routine returns the position of the lower left corner of an axis system in plot coordinates (see AXS-
POS).
91
or: void getpos (int *nxa, int *nya);
GETLEN
GETLEN returns the length of the X-, Y- and Z-axes (see AXSLEN, AX3LEN).
GETHGT
GETHGT returns the character height (see HEIGHT).
GETHNM
GETHNM returns the character height of axis titles (see HNAME).
GETANG
GETANG returns the current character angle used for text and numbers (see ANGLE).
GETALF
GETALF returns the base alphabet (see BASALF).
GETMIX
GETMIX returns control characters used for plotting indices and exponents (see SETMIX, NEWMIX).
GETSHF
GETSHF returns shift characters used for plotting special European characters (see EUSHFT).
92
CNAT is a character string that can have the values ’GERMAN’, ’FRENCH’, ’SPAN-
ISH’, ’DANISH’, ’ACUTE’ , ’GRAVE’ and ’CIRCUM’.
CHAR is a character string containing the returned shift character.
GMXALF
GMXALF returns shift characters used for shifting between the base and an alternate alphabet (see
SMXALF).
GETDIG
This routine returns the number of decimal places that are displayed in axis labels (see LABDIG).
GETGRF
The routine GETGRF returns the current scaling of an axis system.
The call is: CALL GETGRF (XA, XE, XOR, XSTP, CAX) level 2, 3
or: void getgrf (float *xa, float *xe, float *xor, float *xstp, char *cax);
XA, XE are the lower and upper limits of the axis.
XOR, XSTP are the first axis label and the step between labels.
CAX select the axis and can have the values ’X’, ’Y’ and ’Z’.
GETTIC
GETTIC returns the number of ticks that are plotted between axis labels (see TICKS).
GETTCL
GETTCL returns tick lengths (see TICLEN).
GETSP1
GETSP1 returns the distance between axis ticks and labels (see LABDIS).
93
GETSP2
GETSP2 returns the distance between axis labels and names (see NAMDIS).
GETSCL
This routine returns the type of axis scaling used. For linear scaling, the value 0 is returned and for
logarithmic scaling, the value 1 is returned (see AXSSCL).
GETLAB
GETLAB returns the label types used for axis numbering (see LABELS).
GETCLR
GETCLR returns the current colour as an index from the colour table (see SETCLR).
GETUNI
GETUNI returns the logical unit used for error messages.
GETVER
GETVER returns the version number of the currently used DISLIN library.
GETPLV
GETPLV returns the patch level of the currently used DISLIN library.
GETLEV
GETLEV returns the level.
GETSYM
GETSYM returns the current symbol number and height of symbols.
94
The call is: CALL GETSYM (NSYM, NHSYMB) level 1, 2, 3
or: void getsym (int *nsym, int *nhsymb);
GETTYP
GETTYP returns the current line style (see LINTYP).
GETLIN
The routine GETLIN returns the current line width (see LINWID).
GETPAT
The routine GETPAT returns the current shading pattern (see SHDPAT).
GETRES
GETRES returns the width and height of rectangles plotted in 3-D colour graphics (see SETRES,
AUTRES).
GETVLT
GETVLT returns the current colour table (see SETVLT).
GETIND
For a colour index, the routine GETIND returns the corresponding RGB coordinates stored in the current
colour table (see SETIND). If an explicit RGB value is specified, GETIND returns the RGB coordinates
of the RGB value.
The call is: CALL GETIND (I, XR, XG, XB) level 1, 2, 3
or: void getind (int i, float *xr, float *xg, float *xb);
GETRGB
GETRGB returns the RGB coordinates of the current colour.
GETSCR
GETSCR returns the width and height of the screen in pixels.
95
The call is: CALL GETSCR (NWPIX, NHPIX) level 0, 1, 2, 3
or: void getscr (int *nwpix, int *nhpix);
GETBPP
GETBPP returns the number of bits per pixel used by graphics card.
The call is: CALL GETBPP (NBPP) level 0, 1, 2, 3
or: int getbpp ();
GETDSP
The routine GETDSP returns the terminal type.
The call is: CALL GETDSP (CDSP) level 0, 1, 2, 3
or: char *getdsp ();
CDSP is a returned character string that can have the values ’XWIN’ for X Window
terminals, ’WIND’ for Windows terminals and ’NONE’ for none of them.
GETRAN
GETRAN returns the colour range of colour bars (see COLRAN).
The call is: CALL GETRAN (NCA, NCE) level 1, 2, 3
or: void getran (int *nca, int *nce);
GETWID
GETWID returns the width of the colour bar plotted in 3-D colour graphics (see BARWTH).
The call is: CALL GETWID (NZB) level 1, 2, 3
or: int getwid ();
GETVK
This routine returns the lengths used for shifting titles and colour bars (see VKYTIT, VKXBAR, VKY-
BAR).
The call is: CALL GETVK (NYTIT, NXBAR, NYBAR) level 1, 2, 3
or: void getvk (int *nytit, int *nxbar, int *nybar);
GETWIN
This routine returns the upper left corner and the size of the graphics window (see WINDOW, WINSIZ).
The call is: CALL GETWIN (NX, NY, NW, NH) level 1, 2, 3
or: void getwin (int *nx, int *ny, int *nw, int *nh);
GETCLP
The routine GETCLP returns the upper left corner and the size of the current clipping window (see
CLPWIN).
The call is: CALL GETCLP (NX, NY, NW, NH) level 1, 2, 3
or: void getclp (int *nx, int *ny, int *nw, int *nh);
GETXID
The routine GETXID returns the ID of the current X graphics window or pixmap.
The call is: CALL GETXID (ID, CTYPE) level 1, 2, 3
or: int getxid (char *ctype);
ID is the returned window ID.
CTYPE is a character string that can have the values ’WINDOW’ and ’PIXMAP’.
96
Chapter 8
This chapter describes elementary subroutines that plot lines, vectors, circles, ellipses, pie segments and
polygons. There are versions for plot and user coordinates; the routines for user coordinates begin with
the keyword ’RL’. These routines can only be called from level 2 or 3 after an axis system has been
defined.
8.1 Lines
XMOVE and XDRAW are simple subroutines for plotting lines. They require absolute page coordinates
and are, therefore, not affected by a call to ORIGIN. Different line styles cannot be used. The routine
XMOVE moves the pen to a point while XDRAW draws a line to a point.
The subroutines STRTPT and CONNPT require plot coordinates as real numbers and allow different line
styles to be used.
97
Additional note: Lines plotted with RLSTRT and RLCONN will not be cut off at the borders of
an axis system. This can be enabled with the routine CLPBOR. Points lying
outside of the axis scaling will not be listed by RLSTRT and RLCONN.
LINE
LINE joins two points with a line. Different line styles can be used.
The call is: CALL LINE (NX1, NY1, NX2, NY2) level 1, 2, 3
or: void line (int nx1, int ny1, int nx2, int ny2);
RLINE
RLINE is the corresponding routine for user coordinates.
The call is: CALL RLINE (X1, Y1, X2, Y2) level 2, 3
or: void rline (float x1, float y1, float x2, float y2);
8.2 Vectors
VECTOR
VECTOR plots vectors with none, one or two arrow heads.
The call is: CALL VECTOR (IX1, IY1, IX2, IY2, IVEC) level 1, 2, 3
or: void vector (int ix1, int iy1, int ix2, int iy2, int ivec);
98
RLVEC
RLVEC is the corresponding routine for user coordinates.
The call is: CALL RLVEC (X1, Y1, X2, Y2, IVEC) level 2, 3
or: void rlvec (float x1, float y1, float x2, float y2, int ivec);
VECCLR
VECCLR defines the colour of arrow heads, or enables colour scaling in the routines FIELD, VECFLD,
FIELD3D and VECF3D.
ICLR is a colour number. If ICLR has the value -2, colour scaling is enabled in
vector fields. If ICLR = -1, arrow heads are plotted in the foreground colour.
Otherwise, arrow heads are plotted in the colour ICLR.
Default: ICLR = -1.
VECOPT
VECOPT modifies the appearance of arrow heads in vectors if the vector number has the value -1 in
vector plotting routines such as VECTOR and RLVEC, or disables automatic scaling in vector fields.
TRIFLL
The routine TRIFLL plots solid filled triangles.
XRAY, YRAY are floatingpoint arrays containing the three corners of a triangle.
99
8.4 Wind Speed Symbols
WINDBR
The routine WINDBR plots wind speed symbols.
The call is: CALL WINDBR (X, NXP, NYP, NW, A) level 1, 2, 3
or: void windbr (float x, int nxp, int nyp, int nw, float a);
RLWIND
RLWIND is the corresponding routine to WINDBR for user coordinates.
The call is: CALL RLWIND (X, XP, YP, NW, A) level 2, 3
or: void rlwind (float x, float yp, float xp, int nw, float a);
The following subroutines plot geometric figures such as rectangles, circles, ellipses, pie segments and
polygons. These routines can be used to plot only the outlines of figures or the figures can be filled in
with shaded patterns.
RECTAN
RECTAN plots rectangles.
The call is: CALL RECTAN (NX, NY, NW, NH) level 1, 2, 3
or: void rectan (int nx, int ny, int nw, int nh);
RNDREC
RECTAN plots an rectangle where the corners will be rounded.
The call is: CALL RNDREC (NX, NY, NW, NH, IOPT) level 1, 2, 3
or: void rndrec (int nx, int ny, int nw, int nh, int iopt);
CIRCLE
CIRCLE plots circles.
100
The call is: CALL CIRCLE (NX, NY, NR) level 1, 2, 3
or: void circle (int nx, int ny, int nr);
ELLIPS
ELLIPS plots ellipses.
The call is: CALL ELLIPS (NX, NY, NA, NB) level 1, 2, 3
or: void ellips (int nx, int ny, int na, int nb);
PIE
PIE plots pie segments.
The call is: CALL PIE (NX, NY, NR, ALPHA, BETA) level 1, 2, 3
or: void pie (int nx, int ny, int nr, float alpha, float beta);
ARCELL
ARCELL plots elliptical arcs where the arcs can be rotated.
The call is: CALL ARCELL (NX, NY, NA, NB, ALPHA, BETA, THETA)
level 1, 2, 3
or: void arcell (int nx, int ny, int na, int nb, float alpha, float beta, float theta);
AREAF
AREAF draws polygons.
The call is: CALL AREAF (NXRAY, NYRAY, N) level 1, 2, 3
or: void areaf (int *nxray, int *nyray, int n);
NXRAY, NYRAY are arrays containing the plot coordinates of the corner points. Start and end
points can be different.
N is the number of points.
101
The corresponding routines for user coordinates are:
Additional notes: - Shading patterns can be defined with SHDPAT and MYPAT. If the pattern num-
ber is zero, the figures will only be outlined. With CALL NOARLN, the out-
line will be suppressed.
- The number of points in AREAF and RLAREA is limited to 25000 for Fortran
77. There is no limitation for the C and Fortran 90 versions of DISLIN.
- For the calculation of the radius in RLCIRC and RLPIE, the X-axis scaling is
used.
- The interpolation of circles and ellipses can be altered with CIRCSP (NSPC)
where NSPC is the arc length in plot coordinates. The default value is 10.
102
Chapter 9
Utility Routines
This chapter describes the utilities available to transform coordinates, sort data and calculate the lengths
of numbers and character strings.
TRFREL
The routine TRFREL converts arrays of user coordinates to plot coordinates.
103
The call is: CALL TRFREL (XRAY, YRAY, N) level 2, 3
or: void trfrel (float *xray, float *yray, int n);
XRAY, YRAY are arrays containing the user coordinates. After the call, they contain the
calculated plot coordinates.
N is the number of points.
Additional note: The functions above can be used for linear and logarithmic scaling. For polar
scaling, TRFREL and POS2PT can be used for getting plot coordinates.
TRFCO1
The routine TRFCO1 converts one-dimensional coordinates.
The call is: CALL TRFCO1 (XRAY, N, CFROM, CTO) level 0, 1, 2, 3
or: void trfco1 (float *xray, int n, char *cfrom, char *cto);
XRAY is an array containing angles expressed in radians or degrees. After a call to
TRFCO1, XRAY contains the converted coordinates.
N is the number of coordinates.
CFROM, CTO are character strings that can have the values ’DEGREES’ and ’RADIANS’.
TRFCO2
The routine TRFCO2 converts two-dimensional coordinates.
The call is: CALL TRFCO2 (XRAY, YRAY, N, CFROM, CTO) level 0, 1, 2, 3
or: void trfco2 (float *xray, float *yray, int n, char *cfrom, char *cto);
XRAY, YRAY are arrays containing rectangular or polar coordinates. For polar coordinates,
XRAY contains the angles measured in degrees and YRAY the radii.
N is the number of coordinates.
CFROM, CTO are character strings that can have the values ’RECT’ and ’POLAR’.
TRFCO3
The routine TRFCO3 converts three-dimensional coordinates.
The call is: CALL TRFCO3 (XRAY, YRAY, ZRAY, N, CFROM, CTO)
level 0, 1, 2, 3
or: void trfco3 (float *xray, float *yray, float *zray, int n, char *cfrom, char *cto);
XRAY, YRAY, ZRAY are arrays containing rectangular, spherical or cylindrical coordinates. Spher-
ical coordinates must be in the form (longitude, latitude, radius) where 0 ≤
longitude ≤ 360 and -90 ≤ latitude ≤ 90.
Cylindrical coordinates must be in the form (angle, radius, z).
N is the number of coordinates.
CFROM, CTO are character strings that can have the values ’RECT’,’SPHER’ and ’CYLI’.
TRFMAT
The routine TRFMAT converts a matrix to another matrix by bilinear interpolation.
The call is: CALL TRFMAT (ZMAT, NX, NY, ZMAT2, NX2, NY2)
level 0, 1, 2, 3
104
or: void trfmat (float *zmat, int nx, int ny, float *zmat2, int nx2, int ny2);
ZMAT is the input matrix of the dimesion (NX, NY).
NX, NY are the dimensions of the matrix ZMAT.
ZMAT2 is the output matrix of the dimesion (NX2, NY2).
NX2, NY2 are the dimensions of the matrix ZMAT2.
TRMLEN
The function TRMLEN returns the number of characters in a character string.
UPSTR
UPSTR converts a character string to uppercase letters.
UTFINT
UTFINT converts an UTF8 character string to Unicode numbers.
INTUTF
INTUTF converts an array of Unicode number to an UTF8 character string.
105
The call is: CALL INTUTF (IRAY, NRAY, CSTR, NMAX, N) level 0, 1, 2, 3
or: int intutf (int *iray, int nray, char *cstr, int nmax, int nray);
IRAY is an integer array of Unicode numbers.
NRAY is the number elements in IRAY.
CSTR is the returned character string in UTF8 format. For the programming language
C the string is terminated by ’\0’.
NMAX is the maximal number of characters that CSTR can contain.
N is the returned length of CSTR. If an error occured, a negative number is re-
turned.
INTLEN
INTLEN calculates the number of digits in integers.
FLEN
FLEN calculates the number of digits in real numbers.
INTCHA
INTCHA converts integers to character strings.
106
NL is the number of digits in NX returned by INTCHA.
CSTR is the character string containing the integer.
FCHA
FCHA converts real numbers to character strings.
The call is: CALL FCHA (X, NDIG, NL, CSTR) level 0, 1, 2, 3
or: int fcha (float x, int ndig, char *cstr);
X is the real number to be converted.
NDIG is the number of decimal places to be considered (≥ -1). The last digit will be
rounded up.
NL is the number of digits returned by FCHA.
CSTR is the character string containing the real number.
SORTR1
SORTR1 sorts real numbers.
SORTR2
SORTR2 sorts two-dimensional points in the X-direction.
SPLINE
SPLINE calculates splined points used in CURVE to plot a spline.
The call is: CALL SPLINE (XRAY, YRAY, N, XSRAY, YSRAY, NSPL) level 1, 2, 3
or: void spline (float *xray, float *yray, float *xsray, float *ysray, int *nspl);
XRAY, YRAY are arrays containing points of the curve.
N is the dimension of XRAY and YRAY.
XSRAY, YSRAY are the splined points returned by SPLINE.
NSPL is the number of calculated splined points returned by SPLINE. By default,
NSPL has the value 200.
107
Additional note: The number of interpolated points and the order of the polynomials can be
modified with SPLMOD.
BEZIER
The routine BEZIER calculates a Bezier interpolation.
The call is: CALL BEZIER (XRAY, YRAY, N, XPRAY, YPRAY, NP) level 0, 1, 2, 3
or: void bezier (float *xray, float *yray, int n, float *xpray, float *ypray, int np);
XRAY, YRAY are arrays containing points of the curve.
N is the dimension of XRAY and YRAY (1 < N < 21).
XPRAY, YPRAY are the Bezier points returned by BEZIER.
NP is the number of calculated points defined by the user.
HISTOG
The routine HISTOG calculates a histogram.
The call is: CALL HISTOG (XRAY, N, XHRAY, YHRAY, NH) level 0, 1, 2, 3
or: void histog (float *xray, int n, float *xhray, float *yhray, int *nh);
XRAY is an array containing floatingpoint numbers.
N is the dimension of XRAY.
XHRAY, YHRAY are arrays containing the calculated histogram. XHRAY contains distinct val-
ues from XRAY sorted in ascending order. YHRAY contains the frequency of
points.
NH is the number of points in XHRAY und YHRAY returned by HISTOG.
TRIANG
The routine TRIANG calculates the Delaunay triangulation of an arbitrary collection of points in the
plane. The Delaunay triangulation can directly be used to display surfaces and contour lines of irregular-
ily distributed data points.
The call is: CALL TRIANG (XRAY, YRAY, N, I1RAY, I2RAY, I3RAY, NMAX, NTRI)
level 0, 1, 2, 3
or: ntri = triang (float *xray, float *yray, int n, int *i1ray, int *i2ray, int *i3ray,
int nmax);
XRAY, YRAY are arrays containing floatingpoint numbers. The dimension of XRAY and
YRAY must be greater or equal N + 3.
N is the number of points in XRAY and YRAY.
I1RAY, I2RAY, I3RAY are the returned vertices for each triangle in anticlockwise order.
NMAX is the dimension of I1RAY, I2RAY and I3RAY. NMAX must be greater or
equal 2 * N + 1.
NTRI is the returned number of triangles.
Additional notes: - The Watson algorithm is used for calculating the Delaunay triangulation. The
algorithm increases with the number of points as approximately O(N 1.5 ).
Reference: S.W. Sloan and G.T. Houlsby, An Implementation of Watson’s al-
gorithm for computing 2-dimensional Delaunay triangulations, Advanced En-
gineering Software, 1984, Vol. 6, No. 4.
108
- Surfaces and contours can be directly plotted from the triangulation with the
routines CRVTRI, SURTRI and CONTRI.
CIRC3P
The routine CIRC3P calculates a circle specified by three points.
The call is: CALL CIRC3P (X1, Y1, X2, Y2, X3, Y3, XM, YM, R) level 0, 1, 2, 3
or: void circ3p (float x1, float y1, float x2, float y2, float x3, float y3,
float *xm, float *ym, float *r);
X1, Y1 are the X- and Y-coordinates of the first point.
X2, Y2 are the X- and Y-coordinates of the second point.
X3, Y3 are the X- and Y-coordinates of the third point.
XM, YM are the calculated coordinates of the centre point.
R is the calculated radius of the circle.
POLCLP
The routine POLCLP clips a polygon against a rectangle. The Sutherland-Hodman algorithm is used by
POLCLP. This routine must be called four times to clip against all edges of the rectangle.
The call is: CALL POLCLP (XRAY, YRAY, N, XRAY2, YRAY2, NMAX, NOUT, XV,
CEDGE) level 0, 1, 2, 3
or: int polclp (float *xray, float *yray, int n, float *xray2, float *yray2, int nmax,
float xv, char *cedge);
XRAY, YRAY are arrays containing the polygon vertices.
N is the number of the polygon vertices.
XRAY2, YRAY2 are the returned clipped polygon vertices.
NMAX is the maximal number of allowed edges in XRAY2 and YRAY2.
NOUT is the number of vertices in the clipped polygon.
XV is the value of the current edge.
CEDGE is a character string that defines the edge. CEDGE can have the values ’TOP’,
’LEFT’, ’BOTTOM’ and ’RIGHT’.
109
INCDAT
The function INCDAT returns the number of days between a specified date and the base date. This
calculated days can be passed as parameters to the routine GRAF and as coordinates to data plotting
routines such as CURVE.
TRFDAT
The routine TRFDAT calculates for a number of days the corresponding date.
The call is: CALL TRFDAT (N, IDAY, IMONTH, IYEAR) level 0, 1, 2, 3
or: int trfdat (int n, int *iday, int *imonth, int *iyear);
N is the number of days.
IDAY is the returned day number.
IMONTH is the returned month number.
IYEAR is the returned four digit year number.
NWKDAY
The function NWKDAY returns the weekday for a given date.
The call is: CALL BITSI2 (NBITS, NINP, IINP, NOUT, IOUT, IOPT) level 0, 1, 2, 3
or: short bitsi2 (int nbits, short ninp, int iinp, short nout, int iout);
NBITS is the number of bits to be shifted.
NINP is a 16 bit variable from which to extract the bit field.
IINP is the bit position of the leftmost bit of the bit field. The bits are numbered 0 -
15 where 0 is the most significant bit.
NOUT is a 16 bit variable into which the bit field is placed.
IOUT is the bit position where to put the bit field.
110
IOPT controls whether the bits outside of the field are set to zero or not. If IOPT
equal 0, the bits are set to zero. If IOPT not equal 0, the bits are left as they
are. For this case, NOUT is also used as input parameter. In the C function,
IOPT is missing in the parameter list and internally used with the value 1.
BITSI4
The routine BITSI4 allows bit manipulation on 32 bit variables.
The call is: CALL BITSI4 (NBITS, NINP, IINP, NOUT, IOUT, IOPT) level 0, 1, 2, 3
or: int bitsi4 (int nbits, int ninp, int iinp, int nout, int iout);
NBITS is the number of bits to be shifted.
NINP is a 32 bit variable from which to extract the bit field.
IINP is the bit position of the leftmost bit of the bit field. The bits are numbered 0 -
31 where 0 is the most significant bit.
NOUT is a 32 bit variable into which the bit field is placed.
IOUT is the bit position where to put the bit field.
IOPT controls whether the bits outside of the field are set to zero or not. If IOPT
equal 0, the bits are set to zero. If IOPT not equal 0, the bits are left as they
are. For this case, NOUT is also used as input parameter. In the C function,
IOPT is missing in the parameter list and internally used with the value 1.
SWAPI4
The routine SWAPI4 swaps the bytes of 32 bit integer variables.
111
The call is: CALL OPENFL (CFILE, NLU, IRW, ISTAT) level 0, 1, 2, 3
or: int openfl (char *cfile, int nlu, int irw);
CFILE is a character string containing the file name.
NLU is the logical unit for the I/O (0 ≤ NLU ≤ 99). The units 15 and 16 are reserved
for DISLIN.
IRW defines the file access mode (0: READ, 1: WRITE, 2: APPEND).
ISTAT is the returned status (0: no errors).
CLOSFL
The routine CLOSFL closes a file.
READFL
The routine READFL reads a given number of bytes.
The call is: CALL READFL (NLU, IBUF, NBYT, ISTAT) level 0, 1, 2, 3
or: int readfl (int nlu, unsigned char *ibuf, int nbyt);
NLU is the logical unit.
IBUF is an array where to read the bytes.
NBYT is the number of bytes.
ISTAT is the number of bytes read (0 means end of file).
WRITFL
The routine WRITFL writes a number of bytes.
The call is: CALL WRITFL (NLU, IBUF, NBYT, ISTAT) level 0, 1, 2, 3
or: int writfl (int nlu, unsigned char *ibuf, int nbyt);
NLU is the logical unit.
IBUF is an array containing the bytes.
NBYT is the number of bytes.
ISTAT is the number of bytes written (0 means an error).
SKIPFL
The routine SKIPFL skips a number of bytes from the current position.
112
TELLFL
The routine TELLFL returns the current position in bytes.
POSIFL
The routine POSIFL skips to a certain position relative to the start.
ERASE
The routine ERASE clears the screen, a graphics window or the page of a raster format such as TIFF,
PNG, PPM and BMP. In general, this is done by DISINI at the beginning of a plot.
SENDBF
Normally, the graphical output to the screen is buffered. To send the buffer to the screen, the routine
SENDBF can be used.
113
9.8.3 Multiple Windows
The following routines allow programs to create up to 8 windows for graphics output on X11 and Win-
dows terminals. Note, that multiple windows can be used with graphic windows but are not compatible
with other file formats in DISLIN.
OPNWIN
The routine OPNWIN creates a new window for graphics output on the screen.
CLSWIN
The routine CLSWIN closes a window created with OPNWIN.
SELWIN
The routine SELWIN selects a window on the screen where the following graphics output will be sent
to.
PAGWIN
PAGWIN defines the page size for multiple windows. If PAGWIN is not called, the current page size
defined by PAGE or SETPAG is used.
114
NXP, NYP are the length and height of the page in plot coordinates. The lower right corner
of the page is the point (NXP-1, NYP-1).
WINID
The routine WINID returns the ID of the currently selected window.
WINTIT
The routine WINTIT changes the window title of the currently selected window.
CSRKEY
The routine CSRKEY returns a character key. If no character key is pressed, the value 0 is returned.
115
CSRPT1
The routine CSRPT1 returns the position of the mouse pointer if the mouse button 1 is pressed. The
mouse pointer is changed to a cross hair pointer in the graphics window if CSRPT1 is active.
CSRPTS
The routine CSRPTS returns an array of mouse positions. The routine is waiting for mouse button 1
clicks and terminates if mouse button 2 is pressed. The mouse pointer is changed to a cross hair pointer
in the graphics window.
The call is: CALL CSRPTS (NXRAY, NYRAY, NMAX, N, IRET) level 1, 2, 3
or: void csrpts (int *nxray, int *nyray, int nmax, int *n, int *iret);
NXRAY, NYRAY are the returned coordinates of the collected mouse positions.
NMAX is the dimension of NXRAY and NYRAY and defines the maximal number of
points that will be stored in NXRAY and NYRAY.
N is the number of points that are returned in NXRAY and NYRAY.
IRET is a returned status. IRET not equal 0 means that not all mouse movements
could be stored in NXRAY and NYRAY.
CSRMOV
The routine CSRMOV returns an array of mouse movements. The routine collects the mouse movements
of mouse button 1 and terminates if mouse button 1 is released. The mouse pointer is changed to a cross
hair pointer in the graphics window.
The call is: CALL CSRMOV (NXRAY, NYRAY, NMAX, N, IRET) level 1, 2, 3
or: void csrmov (int *nxray, int *nyray, int nmax, int *n, int *iret);
NXRAY, NYRAY are the returned coordinates of the collected mouse movements.
NMAX is the dimension of NXRAY and NYRAY and defines the maximal number of
points that will be stored in NXRAY and NYRAY.
N is the number of points that are returned in NXRAY and NYRAY.
IRET is a returned status. IRET not equal 0 means that not all mouse positions could
be stored in NXRAY and NYRAY.
CSRREC
The routine CSRREC returns two opposite corners of a rectangle created with mouse button 1. A rub-
berband is plotted around the rectangle.
The call is: CALL CSRREC (NX1, NY1, NX2, NY2) level 1, 2, 3
or: void csrrec (int *nx1, int *ny1, int *nx2, int *ny2);
NX1, NY1, NX2, NY2 are the returned coordinates of two opposide rectangle corners.
CSRMOD
The routine CSRMOD modifies the behavior of CSRPOS.
116
The call is: CALL CSRMOD (CMOD, CKEY) level 1, 2, 3
or: void csrmod (char *cmod, char *ckey);
CMOD is a character string that can have the values ’STANDARD’, ’SET’, ’GET’
and ’READ’. With the keywords ’SET’ and ’GET’ the cursor position can be
defined or requested without waiting for an user event. The value ’READ’
means that the cursor position is not set at the entry of CSRPOS. The value
’STANDARD’ means the default behavior of CSRPOS.
CKEY is a character string that can have the value ’POS’.
Default: (’STANDARD’, ’POS’).
CSRUNI
The routine CSRUNI defines if pixels or plot coordinates are returned by the cursor routines.
CSRTYP
The routine CSRTYP defines the cursor used by the cursor routine.
The call is: CALL CSRTYP (COPT) level 1, 2, 3
or: void csrtyp (char *copt);
COPT is a character string that can have the values ’NONE’, ’CROSS’, ’ARROW’
and ’VARROW’. ’NONE’ means that the current cursor is not changed.
Default: COPT = ’CROSS’.
SETCSR
The routine SETCSR defines the cursor that is used by the DISLIN graphics window.
The call is: CALL SETCSR (COPT) level 1, 2, 3
or: void setcsr (char *copt);
COPT is a character string that can have the values ’ARROW’, ’CROSS’ and ’VAR-
ROW’.
Default: COPT = ’ARROW’.
117
The call is: CALL IMGINI level 1, 2, 3
or: void imgini ();
IMGFIN
The routine IMGFIN terminates transfering of image data with the routines RPIXEL, RPIXLS,
RPXROW, WPIXEL, WPIXLS and WPXROW. If the output format is PostScript or PDF, the virtual
image created in IMGINI is copied to the PostScript or PDF file.
RPIXEL
The routine RPIXEL reads one pixel from memory.
WPIXEL
The routine WPIXEL writes one pixel into memory.
RPIXLS
The routine RPIXLS copies colour values from a rectangle in memory to an array.
The call is: CALL RPIXLS (IRAY, IX, IY, NW, NH) level 1, 2, 3
or: void rpixls (unsigned char *iray, int ix, int iy, int nw, int nh);
IRAY is a byte array containing the returned colour values.
IX, IY contain the starting point in screen coordinates.
NW, NH are the width and height of the rectangle in screen coordinates.
WPIXLS
The routine WPIXLS copies colour values from an array to a rectangle in memory.
The call is: CALL WPIXLS (IRAY, IX, IY, NW, NH) level 1, 2, 3
or: void wpixls (unsigned char *iray, int ix, int iy, int nw, int nh);
IRAY is a byte array containing the colour values.
IX, IY contain the starting point in screen coordinates.
NW, NH are the width and height of the rectangle in screen coordinates.
118
RPXROW
The routine RPXROW copies one line of colour values from memory to an array.
WPXROW
The routine WPXROW copies colour values from an array to a line in memory.
IMGMOD
The routine IMGMOD defines palette or truecolour mode for the routines RPIXLS, WPIXLS, RPXROW
and WPXROW. For palette mode, the byte arrays in the routines above must contain colour indices
between 0 and 255. For truecolour mode, the byte arrays must contain RGB values (8 bit for each value).
IMGSIZ
If the output format is PostScript or PDF, the size of images can be defined with the routine IMGSIZ.
The routine must be called before IMGINI.
IMGBOX
If the output format is PostScript or PDF, a rectangle on the output page can be specified where the image
is copied to. The routine IMGBOX must be called before IMGINI.
The call is: CALL IMGBOX (NX, NY, NW, NH) level 1, 2, 3
or: void imgbox (int nx, int ny, int nw, int nh);
NX, NY is the upper left corner of the rectangle on the page in plot coordinates.
119
NW, NH are the width and height of the rectangle in plot coordinates. NW and NH
should have the same ratio as the image that is copied to the rectangle. The
default rectangle is the full page.
RIMAGE
The routine RIMAGE copies an image from memory to a file.
WIMAGE
The routine WIMAGE copies an image from a file to memory.
RTIFF
The routine RTIFF copies an image from memory to a file. The image is stored in the device-independent
TIFF format.
WTIFF
The routine WTIFF copies a TIFF file created by DISLIN from a file to memory.
120
TIFORG
The routine TIFORG defines the upper left corner of the screen where the TIFF file is copied to.
TIFWIN
The routine TIFWIN defines a clipping window of the TIFF file that can be copied with the routine
WTIFF to the screen.
The call is: CALL TIFWIN (NX, NY, NW, NH) level 1, 2, 3
or: void tifwin (int nx, int ny, int nw, int nh);
NX, NY is the upper left corner of the clipping window in pixels.
NW, NH are the width and height of the clipping window in pixels.
RGIF
The routine RGIF copies an image from memory to a GIF file.
RPNG
The routine RPNG copies an image from memory to a PNG file.
RBFPNG
The routine RBFPNG copies an image from memory as a PNG file to a buffer.
RPPM
The routine RPPM copies an image from memory to a PPM file.
121
CFIL is the name of the output file. A new file version will be created for existing
files (see FILMOD).
RBMP
The routine RBMP copies an image from memory to a BMP file.
CFIL is the name of the output file. A new file version will be created for existing
files (see FILMOD).
IMGCLP
The routine IMGCLP defines a clipping region for the routines RTIFF, RGIF, RPNG, RPPM and RBMP
for copying the graphics window to an output file.
The call is: CALL IMGCLP (NX, NY, NW, NH) level 1, 2, 3
or: void imgclp (int nx, int ny, int nw, int nh);
PDFBUF
The routine PDFBUF copies a PDF file from memory to an user buffer. The routine must be called after
DISFIN and PDF buffer output must be enabled with the statment CALL PDFMOD (’ON’, ’BUFFER’)
before DISINI.
Additional note: The PDF file is deleted in memory after it is copied to the buffer.
9.10 Transparency
The following routines allow transparency effects in DISLIN by using alpha blending. Alpha blending
is only possible if the output format is a raster format such as screen output or plotting to an image file
like PNG and TIFF. A second restriction is that the outout device must support the full range of RGB
colours. This means that you have to enable the option IMGFMT (’RGB’) for image files.
TPRINI
The routine TPRINI initializes transparency. All following plotting output until TPRFIN is going to a
separate frame buffer.
122
TPRFIN
The routine TPRFIN terminates transparency. The separate frame buffer is mixed with the real frame
buffer by using alpha blending.
TPRVAL
The routine TPRVAL defines the alpha value.
The following program code plots three circles with alpha blending:
CALL TPRVAL(0.5)
CALL COLOR(’RED’)
CALL TPRINI
CALL CIRCLE(500,500,500)
CALL TPRFIN
CALL COLOR(’GREEN’)
CALL TPRINI
CALL CIRCLE(750,750,500)
CALL TPRFIN
CALL COLOR(’BLUE’)
CALL TPRINI
CALL CIRCLE(1000,500,500)
CALL TPRFIN
TPRMOD
The routine TPRMOD defines additional options for transparency.
123
CALL TPRVAL(0.5)
CALL TPRMOD(’AUTO’,’FIGURES’)
CALL COLOR(’RED’)
CALL CIRCLE(500,500,500)
CALL COLOR(’GREEN’)
CALL CIRCLE(750,750,500)
CALL COLOR(’BLUE’)
CALL CIRCLE(1000,500,500)
THRFIN
The routine THRFIN terminates threads. THRFIN should be called after any other DISLIN routine.
124
Chapter 10
Business Graphics
This chapter presents business graphic routines to create bar graphs and pie charts.
BARTYP
The routine BARTYP defines vertical or horizontal bars.
The call is: CALL BARTYP (CTYP) level 1, 2, 3
or: void bartyp (char *ctyp);
CTYP is a character string defining the bar type.
= ’VERT’ means that vertical bars will be plotted.
= ’HORI’ means that horizontal bars will be plotted. If this parameter is used, XRAY
defines the position of the bars on the Y-axis while Y1RAY and Y2RAY define
the position of the bars on the X-axis.
= ’3DVERT’ defines vertical 3-D bars.
= ’3DHORI’ defines horizontal 3-D bars.
Default: CTYP = ’VERT’.
125
CHNBAR
BARWTH
BARWTH defines the width of the bars.
BARMOD
BARMOD modifies the width of bars.
BARPOS
The position of the bars is determined by the parameters XRAY, Y1RAY and Y2RAY. The routine BAR-
POS can be used to select predefined positions. The parameters XRAY, Y1RAY and Y2RAY will contain
the calculated positions.
126
or: void barpos (char *copt);
COPT is a character string that defines the position of the bars.
= ’NONE’ means that the positions are defined only by the parameters in BARS.
= ’TICKS’ means that the bars will be centred at major ticks. XRAY must be a dummy
vector.
= ’AXIS’ means that vertical bars start at the X-axis and horizontal bars at the Y-axis.
Y1RAY must be a dummy vector.
= ’BOTH’ activates the options ’TICKS’ and ’AXIS’. XRAY and Y1RAY must be
dummy arrays.
Default: COPT = ’NONE’.
Bars can be plotted on top of one another if the routine BARS is called several times. To plot bars side
by side in groups, the routine BARGRP can be used.
BARGRP
The routine BARGRP puts bars with the same axis position into groups. The number of group elements
should be the same as the number of calls to the routine BARS.
BARCLR
The routine BARCLR defines the colours of bars. Different colours can be defined for the sides of 3-D
bars.
BARBOR
The routine BARBOR defines the colour of borders plotted around the bars. By default, a border in the
current colour is plotted around 2-D bars, and borders in the foreground colour are plotted around 3-D
bars.
127
BAROPT
LABELS
The routine LABELS defines labels for bar graphs.
LABPOS
The routine LABPOS defines the position of the labels.
LABDIG
The routine LABDIG defines the number of decimal places in the labels.
128
NDIG is the number of decimal places (≥ -2).
Default: NDIG = 1
LABCLR
The routine LABCLR defines the colour of labels.
The call is: CALL PIEGRF (CBUF, NLIN, XRAY, NSEG) level 1
or: void piegrf (char *cbuf, int nlin, float *xray, int nseg);
CBUF is a character string containing text lines for segment labels. More than one line
can be defined for labels. CBUF must be created with LEGLIN after calling
LEGINI. If NLIN is 0 in the parameter list, CBUF can be a dummy variable.
NLIN is the number of text lines used for one segment label.
XRAY is an array of user coordinates.
NSEG is the dimension of XRAY.
Additional notes: - The centre and the size of pies is defined by a region that can be changed with
the routines AXSPOS and AXSLEN.
- PIEGRF sets the level to 2. Titles and legends can be plotted after PIEGRF is
called.
- Segment labels can contain several lines of text and the data values specified
in PIEGRF. Data values can also be converted to percent values.
- Segment labels are contained within a box where the thickness of the border
can be changed with FRAME.
PIETYP
The routine PIETYP defines 2-D or 3-D pie charts.
The call is: CALL PIETYP (CTYP) level 1, 2, 3
or: void pietyp (char *ctyp);
CTYP is a character string defining the pie type.
= ’2D’ defines a 2-D pie chart.
= ’3D’ defines a 3-D pie chart.
Default: CTYP = ’2D’.
129
CHNPIE
LABELS
LABELS selects data or percent values used for segment labels.
LABPOS
LABPOS determines the position of segment labels.
LABTYP
LABTYP defines the position of text lines in segment labels.
130
or: void labtyp (char *ctyp, ”PIE”);
CTYP is a character string that defines how text lines are justified.
= ’CENTER’ centres text lines.
= ’LEFT’ left-justifies text lines.
= ’RIGHT’ right-justifies text lines.
= ’OUTWARDS’ left-justifies text lines on the left side of pies and right-justifies text lines on
the right side of pies.
= ’INWARDS’ right-justifies text lines on the left side of pies and left-justifies text lines on
the right side of pies.
Default: CTYP = ’CENTER’.
LABDIG
The routine LABDIG defines the number of decimal places used in segment labels.
The call is: CALL LABDIG (NDIG, CDIG) level 1, 2, 3
or: void labdig (int ndig, char *cdig);
NDIG is the number of decimal places (≥ -2).
CDIG is a character string selecting the data values.
= ’PIE’ defines the number of decimal places used for percent and data values.
= ’PERCENT’ defines the number of decimal places used for percent values.
= ’DATA’ defines the number of decimal places used for data values.
Default: (1, ’PIE’).
LABCLR
The routine LABCLR defines the colour of labels.
The call is: CALL LABCLR (NCLR, ’PIE’) level 1, 2, 3
or: void labclr (int nclr, ”PIE”);
NCLR is a colour value. If NCLR = -1, the pie labels will be plotted with the current
colour.
Default: NCLR = -1
PIECLR
The routine PIECLR defines colours for single pies. Different colours can be defined for the top and front
sides of 3-D pies. PIECLR has no effect if the routine CHNPIE is called with the parameters ’COLOR’
or ’BOTH’.
The call is: CALL PIECLR (NC1RAY, NC2RAY, N) level 1, 2, 3
or: void pieclr (int *nc1ray, int *nc2ray, int n);
NC1RAY, NC2RAY are integer arrays containing colour values for the top and front sides of pies.
The value -1 means that the current colour is used.
N is the dimension of NC1RAY and NC2RAY.
PIEBOR
The routine PIEBOR defines the colour of borders plotted around the pies. By default, a border in the
current colour is plotted around 2-D pies, and borders in the foreground colour are plotted around 3-D
pies.
131
The call is: CALL PIEBOR (IC) level 1, 2, 3
or: void piebor (int ic);
IC is a colour value. If IC = -1, the pie borders will be plotted with the current
colour.
Default: IC = -1
PIEOPT
The routine PIEOPT modifies the appearance of 3-D pies.
The call is: CALL PIEOPT (XF, ANG) level 1, 2, 3
or: void pieopt (float xf, float ang);
XF is a scaling number that defines the thickness of pies. The thickness is set to
XF * radius.
ANG defines an view angle measured in degrees.
Default: (0.2, 45.).
PIELAB
The routine PIELAB defines character strings that can be plotted on the left or right side of data values
within segment labels.
The call is: CALL PIELAB (CLAB, CPOS) level 1, 2, 3
or: void pielab (char *clab, char *cpos);
CLAB is a character string displayed in segment labels.
CPOS is a character string that defines the position of CLAB.
= ’LEFT’ means that CLAB will be plotted on the left side of data values.
= ’RIGHT’ means that CLAB will be plotted on the right side of data values.
Additional note: If percent and data values are plotted in segment labels, PIELAB is only used
for data values.
PIEEXP
Pie segments will be offset by 8% of the radius if PIEEXP is called.
The call is: CALL PIEEXP level 1, 2, 3
or: void pieexp ();
Additional note: Single segments will be offset if the corresponding values in PIEGRF are neg-
ative.
PIEVEC
PIEVEC modifies the arrows plotted between segments and labels that lie outside of segments.
The call is: CALL PIEVEC (IVEC, COPT) level 1, 2, 3
or: void pievec (int ivec, char *copt);
IVEC defines the arrow head (see VECTOR).
COPT is a character string that defines the vector plotted between segments and la-
bels.
= ’NONE’ suppresses vectors.
= ’STRAIGHT’ means that straight vectors will be plotted.
= ’BROKEN’ means that broken vectors will be plotted.
Default: (2301, ’BROKEN’).
132
USRPIE
USRPIE is a user-defined subroutine that can modify pie charts such as suppressing certain labels. US-
RPIE is called by PIEGRF for each segment.
The call is: CALL USRPIE (ISEG, XDAT, XPER, NRAD, NOFF, ANGLE,
NVY, IDRW, IANN) level 1, 2, 3
or: void usrpie(int iseg, float xdat, float xper, int *nrad, int *noff, float *angle,
int *nvy, int *idrw, int *iann);
ISEG is the segment index (starting with 1).
XDAT is the data value of the segment as specified in PIEGRF.
XPER is the percent value of XDAT.
NRAD is the segment radius in plot coordinates.
NOFF is the segment offset in plot coordinates (default: 0).
ANGLE is the offset angle measured in degrees in a counter-clockwise direction. The
default value is the angle which bisects the segment.
NVY shifts the segment label in the Y-direction by NVY plot coordinates.
IDRW defines the plotting of segments. If IDRW = 0, plotting will be suppressed
(default: 1).
IANN defines the plotting of labels. If IANN = 0, labels will be suppressed (default:
1).
Additional note: The first 3 parameters of USRPIE are only given for information and cannot
be changed by the user.
10.3 Examples
PROGRAM EX10_1
DIMENSION X(9),Y(9),Y1(9),Y2(9),Y3(9)
CHARACTER*60 CTIT,CBUF*24
NYA=2700
CTIT=’Bar Graphs (BARS)’
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL TICKS(1,’X’)
CALL INTAX
CALL AXSLEN(1600,700)
CALL TITLIN(CTIT,3)
133
CALL LEGINI(CBUF,3,8)
CALL LEGLIN(CBUF,’FIRST’,1)
CALL LEGLIN(CBUF,’SECOND’,2)
CALL LEGLIN(CBUF,’THIRD’,3)
CALL LEGTIT(’ ’)
CALL SHDPAT(5)
DO I=1,3
IF(I.GT.1) CALL LABELS(’NONE’,’X’)
CALL AXSPOS(300,NYA-(I-1)*800)
CALL GRAF(0.,10.,0.,1.,0.,5.,0.,1.)
IF(I.EQ.1) THEN
CALL BARGRP(3,0.15)
CALL BARS(X,Y,Y1,9)
CALL BARS(X,Y,Y2,9)
CALL BARS(X,Y,Y3,9)
CALL RESET(’BARGRP’)
ELSE IF(I.EQ.2) THEN
CALL HEIGHT(30)
CALL LABELS(’DELTA’,’BARS’)
CALL LABPOS(’CENTER’,’BARS’)
CALL BARS(X,Y,Y1,9)
CALL BARS(X,Y1,Y2,9)
CALL BARS(X,Y2,Y3,9)
CALL HEIGHT(36)
ELSE IF(I.EQ.3) THEN
CALL LABELS(’SECOND’,’BARS’)
CALL LABPOS(’OUTSIDE’,’BARS’)
CALL BARS(X,Y,Y1,9)
END IF
IF(I.EQ.3) THEN
CALL HEIGHT(50)
CALL TITLE
END IF
CALL ENDGRF
END DO
CALL DISFIN
END
134
Figure 10.1: Bar Graphs
135
PROGRAM EX10_2
DIMENSION XRAY(5)
CHARACTER*60 CTIT,CBUF*40
DATA XRAY/1.,2.5,2.,2.7,1.8/
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL AXSLEN(1600,1000)
CALL TITLIN(CTIT,2)
CALL LEGINI(CBUF,5,8)
CALL LEGLIN(CBUF,’FIRST’,1)
CALL LEGLIN(CBUF,’SECOND’,2)
CALL LEGLIN(CBUF,’THIRD’,3)
CALL LEGLIN(CBUF,’FOURTH’,4)
CALL LEGLIN(CBUF,’FIFTH’,5)
DO I=1,2
CALL AXSPOS(250,NYA-(I-1)*1200)
IF(I.EQ.2) THEN
CALL LABELS(’DATA’,’PIE’)
CALL LABPOS(’EXTERNAL’,’PIE’)
END IF
CALL PIEGRF(CBUF,1,XRAY,5)
IF(I.EQ.2) THEN
CALL HEIGHT(50)
CALL TITLE
END IF
CALL ENDGRF
END DO
CALL DISFIN
END
136
Figure 10.2: Pie Charts
137
138
Chapter 11
11.1 Introduction
This chapter presents subroutines that plot coloured surfaces in three dimensions. Coloured surfaces are
easy to interpret and show the full range of data points. A data point is plotted as a coloured rectangle
where the X- and Y-coordinates determine the position of the rectangle and the Z-coordinate defines the
colour. Colours are calculated from a scaled colour bar which is, by default, arranged as a rainbow.
The call is: CALL GRAF3 (XA, XE, XOR, XSTEP, YA, YE, YOR, YSTEP,
ZA, ZE, ZOR, ZSTEP) level 1
or: void graf3 (float xa, float xe, float xor, float xstep,
float ya, float ye, float yor, float ystep,
float za, float ze, float zor, float zstep);
XA, XE are the lower and upper limits of the X-axis.
XOR, XSTEP are the first X-axis label and the step between labels.
YA, YE are the lower and upper limits of the Y-axis.
YOR, YSTEP are the first Y-axis label and the step between labels.
ZA, ZE are the lower and upper limits of the Z-axis.
ZOR, ZSTEP are the first Z-axis label and the step between labels.
Additional note: GRAF3 must be called from level 1 and sets the level to 3. For additional
notes, the user is referred to the routine GRAF in chapter 4.
The call is: CALL ZAXIS (A, B, OR, STEP, NL, CSTR, IT, NDIR, NX, NY)
level 1, 2, 3
139
or: void zaxis (float a, float b, float or, float step, int nl, char *cstr, int nx, int ny);
A, B are the lower and upper limits of the colour bar.
OR, STEP are the first label and the step between labels.
NL is the length of the colour bar in plot coordinates.
CSTR is a character string containing the axis name.
IT indicates how ticks, labels and the axis name are plotted. If IT = 0, they
are plotted in a clockwise direction. If IT = 1, they are plotted in a counter-
clockwise direction.
NDIR defines the direction of the colour bar. If NDIR = 0, a vertical colour bar will
be plotted; if NDIR = 1, a horizontal colour bar will be plotted.
NX, NY are the plot coordinates of the lower left corner.
Analog: ZAXLG plots a logarithmically scaled colour bar.
Additional note: The user is referred to the notes on secondary axes in chapter 4.
140
SURSZE, the relationship between the grid points and the matrix elements can
be described by the formula:
ZMAT(I,J) = F(X,Y) where
X = XA + (I - 1) * (XE - XA) / (IXDIM - 1) I = 1,..,IXDIM and
Y = YA + (J - 1) * (YE - YA) / (IYDIM - 1) J = 1,..,IYDIM.
IXDIM, IYDIM define the dimension of ZMAT (≥ 2).
IXPTS, IYPTS are the number of interpolation steps between grid lines (≥ 1). CRVMAT can
interpolate points linearly.
I1RAY, I2RAY, I3RAY is the Delaunay triangulation of the points (XRAY, YRAY) calculated by the
routine TRIANG.
NTRI is the number of triangles in I1RAY, I2RAY and I3RAY.
Additional notes: - CURVE3, CURVY3 and CRVMAT must be called after GRAF3 from level 3.
- The size of coloured rectangles can be defined with the routine SETRES or
calculated automatically by DISLIN using the routine AUTRES.
- Z-coordinates that lie outside of the axis scaling will be plotted with the colour
0 if they are smaller than the lower limit, or with the colour 255 if they are
greater than the upper limit. To reduce computing time and the size of plotfiles,
the plotting of points with the colour 0 can be suppressed with the routine
NOBGD.
- The routines CONMAT and SURMAT are analogs to CRVMAT and plot con-
tours and surfaces of space.
- If SHDMOD (’SMOOTH’, ’SURFACE’) is called before CRVTRI, the trian-
gles will be plotted with interpolated colours. For that case, a raster format is
needed as output format.
AUTRES
With a call to AUTRES, the size of coloured rectangles will be automatically calculated by GRAF3 or
CRVMAT.
SHDMOD
Normally, the routines CURVE3, CURVX3, CURVY3 and CRVMAT plot coloured rectangles, but a
symbol mode can be enabled with the routine SHDMOD. The symbols used by the routines above and
the size of the symbols can be set with the routines MARKER and HSYMBL.
141
The call is: CALL SHDMOD (COPT, ’CURVE’) level 1, 2, 3
or: void shdmod (char *copt, ”CURVE”);
COPT is a character string that can have the values ’RECT’ and ’SYMB’.
Default: COPT = ’RECT’.
AX3LEN
The routine AX3LEN defines the axis lengths of a coloured axis system.
WIDBAR
The routine WIDBAR defines the width of a colour bar.
VKXBAR
The routine VKXBAR defines horizontal shifting of colour bars. The distance between the colour bar
and the axis system is, by default, 85 plot coordinates.
VKYBAR
The routine VKYBAR defines a vertical shifting of colour bars.
NOBAR
The routine NOBAR instructs DISLIN to suppress the plotting of colour bars.
COLRAN
This routine defines the range of colours used for colour bars. By default, the range is 1 to 254.
142
or: void colran (int nca, int nce);
NCA, NCE are colour numbers in the range 1 to 254. Default: (1, 254).
NOBGD
With a call to the routine NOBGD, the plotting of points with the colour 0 will be suppressed. This
reduces plotting time and the size of plotfiles.
EXPZLB
The routine EXPZLB expands the numbering of a logarithmically scaled Z-axis to the next order of
magnitude that lies up or down the axis limits. The scaling of the colour bar will not be changed. This
routine is useful if the range of the Z-axis scaling is smaller than 1 order of magnitude.
The call is: CALL EXPZLB (CSTR) level 1, 2, 3
or: void expzlb (char *cstr);
CSTR is a character string defining the expansion of the Z-axis numbering.
= ’NONE’ means that the numbering will not be expanded.
= ’FIRST’ means that the numbering will be expanded downwards.
= ’BOTH’ means that the numbering will be expanded down- and upwards.
Default: CSTR = ’NONE’.
RECFLL
The routine RECFLL plots a coloured rectangle where the position is determined by the upper left corner.
The call is: CALL RECFLL (NX, NY, NW, NH, NCOL) level 1, 2, 3
or: void recfll (int nx, int ny, int nw, int nh, int ncol);
NX, NY are the plot coordinates of the upper left corner.
NW, NH are the width and height in plot coordinates.
NCOL is a colour value.
POINT
The routine POINT plots a coloured rectangle where the position is determined by the centre.
The call is: CALL POINT (NX, NY, NW, NH, NCOL) level 1, 2, 3
or: void point (int nx, int ny, int nw, int nh, int ncol);
NX, NY are the plot coordinates of the centre point.
NW, NH are the width and height in plot coordinates.
NCOL is a colour value.
143
RLPOIN
The routine RLPOIN plots a coloured rectangle where the position is specified in user coordinates.
The call is: CALL RLPOIN (X, Y, NW, NH, NCOL) level 2, 3
or: void rlpoin (float x, float y, int nw, int nh, int ncol);
Additional note: RLPOIN clips rectangles at the borders of an axis system.
SECTOR
The routine SECTOR plots coloured pie sectors.
The call is: CALL SECTOR (NX, NY, NR1, NR2, ALPHA, BETA, NCOL)
level 1, 2, 3
or: void sector (int nx, int ny, int nr1, int nr2, float alpha, float beta, int ncol);
NX, NY are the plot coordinates of the centre point.
NR1 is the interior radius.
NR2 is the exterior radius.
ALPHA, BETA are the start and end angles measured in degrees in a counter-clockwise direc-
tion.
NCOL is a colour value.
Example: CALL SECTOR (100, 100, 0, 50, 0., 360., NCOL) plots a circle around the
centre (100,100) with the radius 50 and the colour NCOL.
RLSEC
The routine RLSEC plots coloured pie sectors where the centre and the radii are specified in user coor-
dinates.
The call is: CALL RLSEC (X, Y, R1, R2, ALPHA, BETA, NCOL)
level 2, 3
or: void rlsec (float x, float y, float r1, float r2, float alpha, float beta, int ncol);
Additional Notes: - For the conversion of the radii to plot coordinates, the scaling of the X-axis is
used.
- Sectors plotted by RLSEC will not be cut off at the borders of an axis system.
NZPOSN
The function NZPOSN converts a Z-coordinate to a colour number.
144
COLRAY
The routine COLRAY converts an array of Z-coordinates to colour values.
11.8 Example
PROGRAM EX11_1
PARAMETER (N=100)
DIMENSION ZMAT(N,N)
FPI=3.1415927/180.
STEP=360./(N-1)
DO I=1,N
X=(I-1.)*STEP
DO J=1,N
Y=(J-1.)*STEP
ZMAT(I,J)=2*SIN(X*FPI)*SIN(Y*FPI)
END DO
END DO
CALL METAFL(’POST’)
CALL DISINI
CALL PAGERA
CALL PSFONT(’Times-Roman’)
CALL INTAX
CALL AUTRES(N,N)
CALL AXSPOS(300,1850)
CALL AX3LEN(2200,1400,1400)
CALL GRAF3(0.,360.,0.,90.,0.,360.,0.,90.,
* -2.,2.,-2.,1.)
CALL CRVMAT(ZMAT,N,N,1,1)
CALL HEIGHT(50)
CALL PSFONT(’Palatino-BoldItalic’)
CALL TITLE
CALL DISFIN
END
145
3-D Colour Plot of the Function
F(X,Y) = 2 * SIN(X) * SIN(Y)
360 2
270 1
146
180 0
Z-axis
Y-axis
0 -2
0 90 180 270 360
X-axis
Chapter 12
3-D Graphics
This chapter describes routines for 3-D coordinate systems. Axis systems, curves and surfaces can be
drawn from various angular perspectives. All 2-D plotting routines can be used in a 3-D axis system.
12.1 Introduction
Three-dimensional objects must be plotted in a 3-D box which is projected onto a two-dimensional region
on the page. The 3-D box contains an X-, Y- and Z-axis with the Z-axis lying in the vertical direction.
The units of the axes are called absolute 3-D coordinates. They are abstract and have no relation to any
physical units. An axis system is used to scale the 3-D box with user coordinates and to plot axis ticks,
labels and names.
The position and size of a projected 3-D box depends upon the position and size of the region onto
which the box is projected, and the point from which the box is viewed. The region is determined by the
routines AXSPOS and AXSLEN where the centre of the 3-D box will be projected onto the centre of the
region.
AXIS3D
The routine AXIS3D defines the lengths of the 3-D box. For the lengths, any positive values can be
specified; DISLIN uses only the ratio of the values to calculate the axis lengths.
X3AXIS is the length of the X-axis in absolute 3-D coordinates (> 0).
Y3AXIS is the length of the Y-axis in absolute 3-D coordinates (> 0).
Z3AXIS is the length of the Z-axis in absolute 3-D coordinates (> 0).
Default: (2., 2., 2.)
Additional note: The lower left corner of the 3-D box is the point (-X3AXIS/2, -Y3AXIS/2,
-Z3AXIS/2); the upper right corner is the point (X3AXIS/2, Y3AXIS/2,
Z3AXIS/2). The centre point is (0., 0., 0.).
147
The following figure shows the default 3-D box:
(-1/1/1)
(1/1/1)
(-1/-1/1)
(-1/1/-1) (1/-1/1)
(1/1/-1)
(-1/-1/-1)
(1/-1/-1)
Figure 12.1: Default 3-D Box
The call is: CALL VIEW3D (XVU, YVU, ZVU, CVU) level 1, 2, 3
or: void view3d (float xvu, float yvu, float zvu, char *cvu);
XVU, YVU, ZVU define the position of the viewpoint. If CVU = ’ABS’, the parameters must
contain absolute 3-D coordinates, if CVU = ’USER’, they must contain user
coordinates and if CVU = ’ANGLE’, the viewpoint must be specified by two
angles and a radius. In the latter case, XVU is a rotation angle, YVU is the
angle between the line from the viewpoint to the centre of the 3-D box and the
horizontal direction and ZVU is the distance of the viewpoint from the centre
of the 3-D box. XVU and YVU must be specified in degrees and ZVU in
absolute 3-D coordinates.
CVU is a character string defining the meaning of XVU, YVU and ZVU.
Default: (2*X3AXIS, -2.5*Y3AXIS, 2*Z3AXIS, ’ABS’).
Additional note: The viewpoint must be placed outside the 3-D box. If the point lies inside,
DISLIN will print a warning and use the default viewpoint.
148
VFOC3D
The routine VFOC3D defines the focus point. It specifies the location in the 3-D box that the camera
points to.
The call is: CALL VFOC3D (XFOC, YFOC, ZFOC, CVU) level 1, 2, 3
or: void vfoc3d (float xfoc, float yfoc, float zfoc, char *cvu);
XFOC, YFOC, ZFOC define the position of the focus point. If CVU = ’ABS’, the parameters must
contain absolute 3-D coordinates, if CVU = ’USER’, they must contain user
coordinates.
CVU is a character string defining the meaning of XFOC, YFOC and ZFOC.
Default: (0., 0., 0., ’ABS’).
VUP3D
The rotation of the camera around the viewing axis is defined by an angle.
VANG3D
VANG3D defines the view angle. It specifies the field of view of the lens.
The call is: CALL GRAF3D (XA, XE, XOR, XSTEP, YA, YE, YOR, YSTEP,
ZA, ZE, ZOR, ZSTEP) level 1
or: void graf3d (float xa, float xe, float xor, float xstep,
float ya, float ye, float yor, float ystep,
float za, float ze, float zor, float zstep);
XA, XE are the lower and upper limits of the X-axis.
XOR, XSTEP are the first X-axis label and the step between labels.
YA, YE are the lower and upper limits of the Y-axis.
YOR, YSTEP are the first Z-axis label and the step between labels.
ZA, ZE are the lower and upper limits of the Z-axis.
ZOR, ZSTEP are the first Z-axis label and the step between labels.
Additional notes: - GRAF3D must be called from level 1 and sets the level to 3.
149
- By default, the labels and axis titles on the 3-D box are also plotted with a
perspective projection. This default mode does not allow the plotting of hard-
ware fonts and switches automatically to the DISLIN vector font COMPLX if
a hardware font is enabled. Other modes for plotting labels and axis titles that
allow using of hardware fonts can be defined with the routine LABL3D.
- In default mode, GRAF3D suppresses the plotting of certain start labels to
avoid overplotting of labels. This option can be disabled with the statement
CALL FLAB3D.
- The user is referred to the notes on GRAF in chapter 4.
150
Additional notes: - Data points will be interpolated linearly. The user is referred to the notes on
CURVE in chapter 5.
- CURV3D can plot 2-D or 3-D symbols. By default, CURV3D plots 2-D sym-
bols. 3-D symbols are plotted after CALL SHDMOD (’3D’, ’SYMBOL’) or if
the Z-buffer is enabled before.
FIELD3D
The routine FIELD3D plots a vector field where the start and end points of the vectors are already
calculated. The vectors are displayed as arrows.
The call is: CALL FIELD3D (X1RAY, Y1RAY, Z1RAY, X2RAY, Y2RAY, Z2RAY, N,
IVEC) level 3
or: void field3d (float *x1ray, float *y1ray, float *z1ray, float *x2ray, float *y2ray,
float *z2ray, int n, int ivec);
X1RAY, Y1RAY, are arrays that contain the X-, Y- and Z-coordinates of the start points.
Z1RAY
X2RAY, Y2RAY, are arrays that contain the X-, Y- and Z-coordinates of the end points.
Z2RAY
N is the number of vectors.
IVEC is an integer that specifies the form of the arrows (see VECTR3).
VECF3D
The routine VECF3D plots a vector field of given vectors and positions. The vectors are displayed as
arrows.
The call is: CALL VECF3D (XVRAY, YVRAY, ZVRAY, XPRAY, YPRAY, ZPRAY, N,
IVEC) level 3
or: void vecf3d (float *xvray, float *yvray, float *zvray, float *xpray, float *ypray,
float * zpray, int n, int ivec);
XVRAY, YVRAY, are arrays that contain the X-, Y- and Z-coordinates of the vectors.
ZVRAY
XPRAY, YPRAY, are arrays that contain the X-, Y- and Z-coordinates of the start points.
ZPRAY
N is the number of vectors.
IVEC is an integer that specifies the form of the arrows (see VECTR3).
Additional notes: - The length of the arrows is atomatically scaled by DISLIN in the routine
VECF3D. This behavour can be changed with the routine VECOPT, that may
also modify the apperance of arrows.
- The vectors can be scaled with different colours if the routine VECCLR is
called before with the parameter -2. Colour values are scaled between the
minimum and maximum of the vector lengths, or scaled between the values
specified with the routine ZSCALE.
151
12.8 Plotting a Surface Grid from a Function
SURFUN
The routine SURFUN plots a surface grid of the three-dimensional function Z = F(X,Y).
The call is: CALL SURFUN (ZFUN, IXP, XDEL, IYP, YDEL) level 3
or: void surfun ((float) (*zfun()), int ixp, float xdel, int iyp, float ydel);
ZFUN is the name of a FUNCTION subroutine that returns the function value for a
given X- and Y-coordinate. ZFUN must be declared EXTERNAL in the calling
program.
XDEL, YDEL are the distances between grid lines in user coordinates. XDEL and YDEL
determine the density of the surface plotted by SURFUN.
IXP, IYP are the number of points between grid lines interpolated by SURFUN (≥ 0). If
IXP = 0, surface lines in the X-direction will be suppressed; if IYP = 0, surface
lines in the Y-direction will be suppressed.
The calls are: CALL SURMAT (ZMAT, IXDIM, IYDIM, IXPTS, IYPTS) level 3
CALL SURFCE (XRAY, IXDIM, YRAY, IYDIM, ZMAT) level 3
or: void surmat (float *zmat, int ixdim, int iydim, int ixpts, int iypts);
void surfce (float *xray, int ixdim, float *yray, int iydim, float *zmat);
Additional notes: - The routines SURMAT and SURFCE suppress automatically hidden lines. The
suppression can be disabled with the statement CALL NOHIDE.
- SURMAT and SURFCE use a horizon line algorithm for suppressing hidden
lines. This algorithm is efficient but may fail for some complex data structures.
An alternate method for suppressing hidden lines can be used with the routine
SURSHD if only mesh lines are enabled with the statement CALL SURMSH
(’ONLY’).
- Surfaces can be protected from overwriting with CALL SHLSUR if the
hidden-line algorithm is not disabled.
152
- The limits of the base grid are determined by the parameters in GRAF3D or
can be altered with SURSZE (XA, XE, YA, YE). If XA, XE, YA and YE are
the axis limits in GRAF3D or defined with SURSZE, the connection of grid
points and matrix elements can be described by the formula:
ZMAT(I,J) = F(X,Y) where
X = XA + (I - 1) * (XE - XA) / (IXDIM - 1) I = 1,..,IXDIM and
Y = YA + (J - 1) * (YE - YA) / (IYDIM - 1) J = 1,..,IYDIM.
- SURVIS (CVIS) determines the visible part of a surface where CVIS can have
the values ’TOP’, ’BOTTOM’ and ’BOTH’. The default value is ’BOTH’.
- The statement CALL SURCLR (ICTOP, ICBOT) defines the colours of the
upper and lower side of a surface where ICTOP and ICBOT contain colour
values.
The call is: CALL SURSHD (XRAY, IXDIM, YRAY, IYDIM, ZMAT) level 3
or: void surshd (float *xray, int ixdim, float *yray, int iydim, float *zmat);
XRAY, YRAY are arrays containing the X- and Y-user coordinates.
ZMAT is a matrix with the dimension (IXDIM, IYDIM) containing the function val-
ues.
IXDIM, IYDIM are the dimensions of ZMAT, XRAY and YRAY (≥ 2).
Additional notes: - The statement CALL ZSCALE (ZMIN, ZMAX) defines an alternate Z-scaling
that will be used to calculate colour values in SURSHD. Normally, the Z-
scaling in GRAF3D is used. For logarithmic scaling of the Z-axis, ZMIN
and ZMAX must be exponents of base 10. If SHDMOD (’OFF’, ’ZSCALE’)
is used before SURSHD, the calculating of colour values is disabled and the
current colour and material settings are used for the surface.
- A flat shading or a smooth shading can be selected with the routine SHDMOD.
The default is flat shading. SURSHD uses automatically a depth sort for flat
shading and a Z-buffer for smooth shading to eliminate hidden surfaces if these
algorithms are not already enabled with the routines DBFINI and ZBFINI. If
smooth shading is selected, a raster format is needed for the graphics output
format (for example METAFL (’XWIN’) or METAFL (’TIFF’)).
- By default, SURSHD plots first the bottom and then the top of the surface
where backface culling is enabled. Backface culling means that single poly-
gons that are not facing the viewpoint are removed. This is done by comparing
the polygons surface normal with the position of the viewpoint. This behaviour
can be modified with the routines SURVIS and SHDMOD.
- Additional grid lines can be enabled with the routine SURMSH. SURSHD can
generate only mesh lines if the keyword ’ONLY’ is used in SURMSH.
- Lighting can be enabled for SURSHD with the routine LIGHT. If lighting is
enabled, the function values are used for setting diffuse material parameters of
the surface.
153
12.11 Plotting a Shaded Surface from a Parametric Function
SURFCP
A three-dimensional parametric function is a function of the form (x(t,u), y(t,u), z(t,u)) where tmin
≤ t ≤ tmax and umin ≤ u ≤ umax. The routine SURFCP plots a shaded surface from a parametric
function. The colours of the surface are calculated from the Z-scaling in the routine GRAF3D or from
the parameters of the routine ZSCALE.
The call is: CALL SURFCP (ZFUN, TMIN, TMAX, TSTEP, UMIN, UMAX, USTEP)
level 3
or: void surfcp ((float) (*zfun()), float tmin, float tmax, float tstep, float umin,
float umax, float ustep);
ZFUN is the name of a FUNCTION subroutine with the formal parameters X, Y and
IOPT. If IOPT = 1, ZFUN should return the X-coordinate of the parametric
function, if IOPT = 2, ZFUN should return the Y-coordinate and if IOPT = 3,
ZFUN should return the Z-coordinate.
TMIN, TMAX, TSTEP define the range and step size of the first parameter.
UMIN, UMAX, USTEP define the range and step size of the second parameter.
Additional note: The user is referred to the notes on SURSHD.
The call is: CALL SURTRI (XRAY, YRAY, ZRAY, N, I1RAY, I2RAY, I3RAY, NTRI)
level 3
or: void surtri (float *xray, float *yray, float *zray, int n,
int *i1ray, int *i2ray, int *i3ray, int ntri);
XRAY is an array containing the X-coordinates of data points.
YRAY is an array containing the Y-coordinates of data points.
ZRAY is an array containing the Z-coordinates of data points.
N is the number of data points.
I1RAY, I2RAY, I3RAY is the Delaunay triangulation of the points (XRAY, YRAY) calculated by the
routine TRIANG.
NTRI is the number of triangles in I1RAY, I2RAY and I3RAY.
Additional note: The user is referred to the notes on SURSHD.
The call is: CALL SURISO (XRAY, NX, YRAY, NY, ZRAY, NZ, WMAT, WLEV)
level 3
154
or: void suriso (float *xray, int nx, float *yray, int ny,
float *zray, int nz, float *wmat, float wlev);
XRAY, YRAY, ZRAY are arrays containing the X-, Y- and Z-user coordinates.
WMAT is a matrix with the dimension (NX, NY, NZ) containing the function values.
NX, NY, NZ are the dimensions of WMAT, XRAY, YRAY, and ZRAY (≥ 2).
WLEV defines the level of the isosurface.
Additional notes: - The algorithm used in SURISO is based on the Marching Cubes method.
Reference: Lorensen, W.E. and Cline, H.E., Marching Cubes: a high resolu-
tion 3D surface reconstruction algorithm, Computer Graphics, Vol. 21, No. 4,
pp 163-169 (Proc. of SIGGRAPH), 1987.
- The user is referred to the notes on SURSHD.
ISOPTS
The routine ISOPTS calculates an isosurface of the form f(x,y,z) = constant. A triangulation of the
calculated isosurface is returned.
The call is: CALL ISOPTS (XRAY, NX, YRAY, NY, ZRAY, NZ, WMAT, WLEV,
XTRI, YTRI, ZTRI, NMAX, NTRI) level 3
or: void isopts (float *xray, int nx, float *yray, int ny, float *zray, int nz,
float *wmat, float wlev, float *xtri, float *ytri, float *ztri, int nmax, int *ntri);
XRAY, YRAY, ZRAY are arrays containing the X-, Y- and Z-user coordinates.
WMAT is a matrix with the dimension (NX, NY, NZ) containing the function values.
NX, NY, NZ are the dimensions of WMAT, XRAY, YRAY, and ZRAY (≥ 2).
WLEV defines the level of the isosurface.
XTRI, YTRI, ZTRI are arrays containing the calculated triangles. The first three coordinates con-
tain the first triangle, the next three coordinates the second triangle and so on.
The triangles are returned in anti-clockwise orientation.
NMAX is the maximal number of elements for the arrays XTRI, YTRI and ZTRI.
NTRI is the returned number of calculated triangles.
The call is: CALL BARS3D (XRAY, YRAY, Z1RAY, Z2RAY, XWRAY, YWRAY,
ICRAY, N) level 3
or: void bars3d (float *xray, float *yray, float *z1ray, float *z2ray, float *xwray,
float *ywray, int *icray, int n);
XRAY is an array of user coordinates defining the position of the bars on the X-axis.
YRAY is an array of user coordinates defining the position of the bars on the Y-axis.
Z1RAY is an array of user coordinates containing the start points of the bars on the
Z-axis.
Z2RAY is an array of user coordinates containing the end points of the bars on the
Z-axis.
155
XWRAY is an array of user coordinates defining the width of the bars in X-direction.
YWRAY is an array of user coordinates defining the width of the bars in Y-direction.
ICRAY is an array of colour values used for the bars. The foreground colour is used
for the colour value -1.
N is the number of bars.
Additional note: Legends are supported for 3-D bar graphs. Legend entries are done for each
new colour in ICRAY.
NOHIDE
The suppression of hidden lines in the routines SURFUN, SURMAT and SURFCE can be disabled with
a call to NOHIDE.
SHLSUR
The surfaces plotted by the routines SURFUN, SURMAT and SURFCE can be protected from overwrit-
ing with the routine SHLSUR.
SUROPT
Surface lines plotted with the routine SURFCE can be suppressed for the X- and Y-directions.
The call is: CALL SUROPT (COPT) level 1, 2, 3
or: void suropt (char *copt);
COPT is a character string that can have the values ’XISO’, ’YISO’ and ’BOTH’. If
COPT = ’XISO’, surface lines in the Y-direction will be suppressed by SUR-
FCE. If COPT = ’YISO’, surface lines in the X-direction will be suppressed.
Default: COPT = ’BOTH’.
SURVIS
The routine SURVIS determines which part of a surface is plotted.
156
The call is: CALL SURVIS (CVIS) level 1, 2, 3
or: void survis (char *cvis);
CVIS is a character string that can have the values ’AUTO’, ’TOP’, ’BOTTOM’ and
’BOTH’. ’AUTO’ means that the value ’TOP’ is used for closed surfaces such
as a sphere and that ’BOTH’ is used for non closed surfaces such as surfaces
plotted by SURSHD, SURFCP and SURTRI.
Default: CVIS = ’AUTO’.
SURCLR
The routine SURCLR defines the colours of the upper and lower side of surfaces.
SHDMOD
The routine SHDMOD defines some shading parameters such as flat or smooth shading.
SURMSH
The routine SURMSH can enable additional grid lines for surfaces, or disable the shading of a surface.
157
MSHCLR
The routine MSHCLR sets the colour for grid lines. Different colours can be selected for the upper and
lower side of surfaces if the routine SETFCE is used before.
SETFCE
The routine SETFCE selects the surface side for which mesh colours or material parameters are applied
by the routines MSHCLR and MATOP3.
ZSCALE
The routine ZSCALE defines an alternate Z-scaling that will be used to calculate colour values in the
routines SURTRI, SURSHD, SURFCP, CONSHD and CONTRI.
CLIP3D
The routine CLIP3D defines 3-D clipping in the world coordinate system or in the eye coordinate system,
or disables clipping.
VCLP3D
If 3-D clipping is done in the eye coordinate system, front and back clipping planes can be defined with
the routine VCLP3D.
HSYM3D
The routine HSYM3D sets the symbol size for 3-D symbols plotted by SYMB3D and CURV3D.
158
The call is: CALL HSYM3D (H) level 1, 2, 3
or: void hsym3d (float h);
H is the symbol height in absolute 3-D coordinates. Default: H = 0.08
ROT3D
The routine ROT3D sets rotation angles for 3-D symbols and solids.
12.16 Lighting
Lighting can be enabled for some shading routines such as SURSHD, SURFCP, SURTRI and SURISO
where up to 8 light sources can be defined. General lighting can be turned off or on in DISLIN with the
routine LIGHT while single light sources can be turned off or on with the routine LITMOD. The routine
LITPOS defines the position of light sources and the routines LITOP3 and MATOP3 modify lighting and
material parameters. Finally, the routine GETLIT calculates the colour value for a specified point and
normal.
LIGHT
The routine LIGHT enables lighting for shading routines such as SURSHD, SURFCP and SURISO.
LITMOD
Up to 8 light sources can be defined in DISLIN. The routine LITMOD enables or disables single light
sources.
LITPOS
The routine LITPOS defines the position of light sources.
The call is: CALL LITPOS (ID, XP, YP, ZP, COPT) level 1, 2, 3
or: void litpos (int id, float xp, float yp, float zp, char *copt);
ID is the ID of the light source in the range 1 to 8.
159
XP, YP, ZP define the position of the light source. If COPT = ’ABS’, the parameters must
contain absolute 3-D coordinates, if COPT = ’USER’, they must contain user
coordinates and if COPT = ’ANGLE’, the position must be specified by two
angles and a radius (see VIEW3D).
COPT is a character string defining the meaning of XP, YP and ZP.
Default: (2*X3AXIS, -2.5*Y3AXIS, 2*Z3AXIS, ’ABS’).
LITOPT
The routine LITOPT modifies the constant, linear and quadratic attentuation factors of light sources.
LITOP3
The routine LITOP3 modifies the ambient, diffuse and specular intensities of light sources.
The call is: CALL LITOP3 (ID, XR, XG, XB, COPT) level 1, 2, 3
or: void litop3 (int id, float xr, float xg, float xb, char *copt);
ID is the ID of the light source in the range 1 to 8.
XR, XG, XB are floatingpoint numbers in the range 0 to 1 for R, G and B.
COPT is a character string that can have the values ’AMBIENT’, ’DIFFUSE’ and
’SPECULAR’.
Defaults: (0., 0., 0., ’AMBIENT’), (1., 1., 1., ’DIFFUSE’),
(1., 1., 1., ’SPECULAR’).
MATOPT
The routine MATOPT modifies material parameters.
MATOP3
The routine MATOP3 modifies material parameters such as ambient, diffuse and specular colour. Mate-
rial parameters can be defined for different sides of a surface if the routine SETFCE is used before.
The call is: CALL MATOP3 (XR, XG, XB, COPT) level 1, 2, 3
or: void matop3 (float xr, float xg, float xb, char *copt);
XR, XG, XB are floatingpoint numbers in the range 0 to 1 containing the new material pa-
rameters for R, G and B.
160
COPT is a character string that can have the values ’AMBIENT’, ’DIFFUSE’ and
’SPECULAR’.
Defaults: (0.2, 0.2, 0.2, ’AMBIENT’), (0.8, 0.8, 0.8, ’DIFFUSE’),
(0., 0., 0., ’SPECULAR’).
GETLIT
The routine GETLIT calculates colour values for given points and their normals specified in absolute
coordinates.
The call is: CALL GETLIT (XP, YP, ZP, XN, YN, ZN, ICLR) level 1, 2, 3
or: int getlit (float xp, float yp, float zp, float xn, float yn, float zn);
XP, YP, ZP are the X-, Y-and Z-coordinates of the point.
XN, YN, ZN are the X-, Y- and Z-coordinates of the point normal.
ICLR is the returned colour value. ICLR contains an explicit RGB value.
The value ZMAT(J, K) of the corresponding grid point (J, K) is calculated by the formula:
n 1
w Zi
P
D
i=1 i
ZM ATj,k = n 1
P
w
i=1 Di
161
where: j, k are indices from 1 to NX and 1 to NY, respectively.
Di is the distance of the grid point (i, k) from the point Pi .
w is a weighting number (Default: 2.0).
n is the number of data points lying in the area around the grid point (j, k).
If Pi is a data point, the routine GETMAT finds the grid rectangle in the XY-plane in which the point
lies. By default, Pi affects all grid points which lie up to 2 grid lines from Pi . A problem can arise when
creating a large matrix from sparse data points because certain grid points may not lie near the actual
random data points. Figure 12.2 shows the results of GETMAT using different values of IX and IY.
100 100
80 80
60 60
40 40
20 20
0 0
0 20 40 60 80 100 0 20 40 60 80 100
An simple method to smooth surfaces from sparse data points is to enlarge the region around the ran-
domly distributed data points where grid points are searched. This can be done using the routine MDF-
MAT.
MDFMAT
The routine MDFMAT modifies the algorithm in GETMAT.
162
W is a weighting number.
Default: (2, 2, 2.0).
163
12.18 Projection of 2-D-Graphics into 3-D Space
Two-dimensional graphics in the XY-plane can be projected onto a plane in 3-D space. Therefore, all
2-D plot routines can be used in 3-D space.
GRFINI
The routine GRFINI defines a plane in the 3-D box onto which all plot vectors will be projected. The
plane in the 3-D box corresponds to a region in the XY-plane which is determined by AXSPOS and
AXSLEN. GRFINI sets the level to 1.
The call is: CALL GRFINI (X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3) level 3
or: void grfini (float x1, float y1, float z1, float x2, float y2, float z2,
float x3, float y3, float z3);
X1, Y1, Z1 are the absolute 3-D coordinates of the lower left corner of the 3-D plane.
X2, Y2, Z2 are the absolute 3-D coordinates of the lower right corner of the 3-D plane.
X3, Y3, Z3 are the absolute 3-D coordinates of the upper right corner of the 3-D plane.
Additional note: If (NXA,NYA) is the lower left corner, NXL the width and NYL the height
of the region determined by the routines AXSPOS and AXSLEN, the point
(X1,Y1,Z1) corresponds to (NXA,NYA), (X2,Y2,Z2) to (NXA+NXL-1,NYA)
and (X3,Y3,Z3) to (NXA+NXL-1,NYA-NYL+1), respectively.
GRFFIN
The routine GRFFIN terminates a projection into 3-D space. The level will be set back to 3.
ZBFFIN
The routine ZBFFIN terminates writing to a Z-buffer. For screen output, the internal frame buffer is
copied back to the graphics window.
164
ZBFRES
The routine ZBFRES resets the Z-buffer to it’s initial values without changing a corresponding frame
buffer.
ZBFERS
The routine ZBFERS erases the frame buffer connected with a Z-buffer.
The following both elementary routines can be used to plot triangles and lines directly to the Z-buffer.
ZBFTRI
The routine ZBFTRI plots a smooth triangle where hidden-surface elimination is done with the Z-buffer.
The call is: CALL ZBFTRI (XRAY, YRAY, ZRAY, IRAY) level 3
or: void zbftri (float *xray, float *yray, float *zray, int *iray);
XRAY,YRAY,ZRAY are the X-, Y-, and Z-coordinates of the three corners of the triangle in user
coordinates.
IRAY is an integer array containing the three colour values of the triangle corners.
ZBFLIN
The routine ZBFLIN plots a line in the current colour where the Z-buffer is used for hiddenline elimina-
tion.
The call is: CALL ZBFLIN (X1, Y1, Z1, X2, Y2, Z2) level 3
or: void zbflin (float x1, float y1, float z1, float x2, float y2, float z2);
X1, Y1, Z1 are the user coordinates of the start point.
X2, Y2, Z2 are the user coordinates of the end point.
ZBFSCL
The routine ZBFSCL changes the resolution of an internal image which is used for raster operations
for PDF output. The resolution of the internal image corresponds to the DISLIN plot page converted to
points, where 1 point = 1 / 72 inch. This resolution is multiplied with the value in ZBFSCL. For example:
the internal image corresponding to the default page ’DA4L’ has the resolution 1263 x 892 points.
DBFINI
The routine DBFINI initializes a depth sort for polygon faces. A depth sort is useful for hidden-surface
elimination if the output format is no raster format so that the Z-buffer cannot be used.
165
IRET is the returned status (0: no errors).
DBFFIN
The routine DBFFIN terminates the depth sort. All polygon faces are sorted and plotted. The polygon
faces with the greatest distance from the viewpoint are plotted first.
CONN3D
The routine CONN3D plots a line from the current pen position to a three-dimensional point. The line
will be cut off at the sides of the 3-D box. Different line styles can be used.
VECTR3
The routine VECTR3 plots a vector in the 3-D box.
The call is: CALL VECTR3 (X1, Y1, Z1, X2, Y2, Z2, IVEC) level 3
or: void vectr3 (float x1, float y1, float z1, float x2, float y2, float z2, int ivec);
X1, Y1, Z1 are the absolute 3-D coordinates of the start point.
X2, Y2, Z2 are the absolute 3-D coordinates of the end point.
IVEC defines the arrow head. If IVEC = -2, a 3-D cone is used for the arrow head.
Otherwise, IVEC has the same meaning as in VECTOR.
TRIA3D
The routine TRIA3D plots a triangle.
166
The next three routines VTX3D, VTXC3D and VTXN3D define vertices for plotting lines, points,
curves, triangles, quadrilaterals and polygons. Note that backface culling is enabled by default in
DISLIN. Therefore, vertices for shaded triangles, quadrilaterals and polygons should be specified in
a counter-clockwise orientation, or they will not be plotted if backface culling is on.
VTX3D
The routine VTX3D plots lines, points, curves, triangles, quadrilaterals or polygons from a set of vertices.
The call is: CALL VTX3D (XRAY, YRAY, ZRAY, N, COPT) level 3
or: void vtx3d (float *xray, float *yray, float *zray, int n, char *copt);
XRAY, YRAY, ZRAY define vertices in user coordinates.
N is the number of vertices.
COPT is a character string that defines how vertices are plotted:
= ’POINTS’ The vertices are plotted with a small ’+’ sign, where the size of the symbol can
be modified with HSYMBL.
= ’LINES’ Separated lines are plotted, each specified by a pair of vertices.
= ’CURVE’ A series of connected lines is plotted.
= ’PLINE’ The same as ’CURVE’ except that the last vertex is connected with the first
vertex.
= ’TRIANG’ Separate shaded triangles are plotted for each set of three vertices.
= ’TSTRIPS’ A series of triangles is plotted connected along shared edges. The triangles are
(1, 2, 3), (3, 2, 4), (3, 4, 5), (5, 4, 6), ...., where the vertices are numbered by 1,
2, 3, ..., n.
= ’QUADS’ Separate shaded quads are plotted for each set of four vertices.
= ’QSTRIPS’ A series of quads is plotted connected along shared edges. The quads are (1,
2, 4, 3), (3, 4, 6, 5), (5, 6, 8, 7), ...., where the vertices are numbered by 1, 2, 3,
..., n.
= ’POLYGON’ A shaded polygon is plotted where the polygon should be convex. The polygon
is rendered by a series of triangles.
Additional note: If lighting is enabled, normal vectors for calculating colour values are auto-
matically generated by DISLIN.
VTXC3D
The routine VTXC3D is a similar routine to VTX3D except that an user can specify additional colour
values for the vertices.
The call is: CALL VTXC3D (XRAY, YRAY, ZRAY, ICRAY, N, COPT) level 3
or: void vtxc3d (float *xray, float *yray, float *zray, int *icray, int n, char *copt);
XRAY, YRAY, ZRAY define vertices in user coordinates.
ICRAY contains the colour values of vertices.
N is the number of vertices.
COPT is a character string that defines how vertices are plotted (see VTX3D).
VTXN3D
The routine VTXN3D is a similar routine to VTX3D except that a normal vector can be specified for
each vertex.
167
The call is: CALL VTXN3D (XRAY, YRAY, ZRAY, XNRAY, YNRAY, ZNRAY, N,
COPT) level 3
or: void vtxn3d (float *xray, float *yray, float *zray,
float *xnray, float *ynray, float *znray, int n, char *copt);
XRAY, YRAY, ZRAY define vertices in user coordinates.
XNRAY, YNRAY, contain the normal vectors for each vertex.
ZNRAY
N is the number of vertices.
COPT is a character string that defines how vertices are plotted (see VTX3D).
The following routines plot elementary solids such as spheres, cones and quads. All solids can be rotated
around the center point if rotation angles are defined with the routine ROT3D. Three-dimensional trans-
formations such as shifting, scaling and rotation about an axis can be defined with the routines TR3SHF,
TR3SCL and TR3ROT. Smooth or flat shading can be used and hidden-surface elimination can be en-
abled with the routines ZBFINI and DBFINI. For closed solids such as spheres and quads, only the top
faces are plotted while for non closed solids such as cones and tubes, the top and bottom faces are plot-
ted. This behaviour can be modified with the routine SURVIS. By default, backface culling is enabled
for all solids which can be disabled with the routine SHDMOD. Lighting can be enabled with the routine
LIGHT and additional grid lines will be plotted after a call to SURMSH with the parameter ’ON’.
SPHE3D
The routine SPHE3D plots a sphere.
CONE3D
The routine CONE3D plots a cone or a truncated cone.
The call is: CALL CONE3D (XM, YM, ZM, R, H1, H2, N, M) level 3
or: void cone3d (float xm, float ym, float zm, float r, float h1, float h2,
int n, int m);
XM, YM, ZM are the user coordinates of the lower center point.
R is the radius of the cone in user coordinates.
H1, H2 are the heights of the truncated cone. If H1 = H2, the cone is not truncated.
N, M defines the horizontal and vertical resolution of the cone.
PIKE3D
The routine PIKE3D plots a cone specified by two points.
The call is: CALL PIKE3D (X1, Y1, Z1, X2, Y2, Z2, R, N, M) level 3
or: void pike3d (float x1, float y1, float z1, float x2, float y2, float z2, float r,
int n, int m);
X1, Y1, Z1 are the user coordinates of the starting center point.
168
X2, Y2, Z2 are the user coordinates of the ending point.
R is the radius of the cone in user coordinates.
N, M define the horizontal and vertical resolution of the cone.
CYLI3D
The routine CYLI3D plots a cylinder.
TUBE3D
The routine TUBE3D plots a tube.
The call is: CALL TUBE3D (X1, Y1, Z1, X2, Y2, Z2, R, N, M) level 3
or: void tube3d (float x1, float y1, float z1, float x2, float y2, float z2, float r,
int n, int m);
X1, Y1, Z1 are the user coordinates of the starting center point.
X2, Y2, Z2 are the user coordinates of the ending center point.
R is the radius of the tube in user coordinates.
N, M defines the horizontal and vertical resolution of the tube.
DISK3D
The routine DISK3D plots a disk.
The call is: CALL DISK3D (XM, YM, ZM, R1, R2, N, M) level 3
or: void disk3d (float xm, float ym, float zm, float r1, float r2, int n, int m);
XM, YM, ZM are the user coordinates of the center point.
R1, R2 are the inner and outer radii in user coordinates.
N, M defines the horizontal and vertical resolution of the disks.
QUAD3D
The routine QUAD3D plots a quad.
The call is: CALL QUAD3D (XM, YM, ZM, XL, YL, ZL) level 3
or: void quad3d (float xm, float ym, float zm, float xl, float yl, float zl);
XM, YM, ZM are the user coordinates of the center point.
XL, YL, ZL are the length of the edges in X-, Y- and Z-direction in user coordinates.
PYRA3D
The routine PYRA3D plots a pyramid or a truncated pyramid.
The call is: CALL PYRA3D (XM, YM, ZM, XL, H1, H2, N) level 3
169
or: void pyra3d (float xm, float ym, float zm, float xl, float h1, float h2, int n);
XM, YM, ZM are the user coordinates of the lower center point.
XL is the length of the pyramid in user coordinates.
H1, H2 are the heights of the truncated pyramid in user coordinates. If H1 = H2, the
pyramid is not truncated.
N can have the values 3 and 4 and defines the number of sides.
PLAT3D
The routine PLAT3D plots a Platonic solid. The 5 Platonic solids are tetrahedron, cube, octahedron,
dodecahedron and icosahedron.
The call is: CALL PLAT3D (XM, YM, ZM, XL, COPT) level 3
or: void plat3d (float xm, float ym, float zm, float xl, char *copt);
SYMB3D
The routine SYMB3D plots a 3-D symbol.
The call is: CALL SYMB3D (N, XM, YM, ZM) level 3
or: void symb3d (int n, float xm, float ym, float zm);
N is the symbol number between 0 and 5. The symbols are cube, tetrahedron,
octahedron, dodecahedron, icosahedron and sphere.
XM, YM, ZM are the user coordinates of the center point.
Additional note: The size of 3-D symbols can be defined with the routine HSYM3D.
TORUS3D
The routine TORUS3D plots a torus.
The call is: CALL TORUS3D (XM, YM, ZM, R1, R2, H, A1, A2, N, M) level 3
or: void torus3d (float xm, float ym, float zm, float r1, float r2, float h,
float a1, float a2, int n, int m);
170
12.21 Transformation of Coordinates
POS3PT
The routine POS3PT converts three-dimensional user coordinates to absolute 3-D coordinates.
The call is: CALL POS3PT (X, Y, Z, XP, YP, ZP) level 3
or: void pos3pt (float x, float y, float z, float *xp, float *yp, float *zp);
X, Y, Z are the user coordinates.
XP, YP, ZP are the absolute 3-D coordinates calculated by POS3PT.
The absolute 3-D coordinates can also be calculated with the following functions:
XP = X3DPOS (X, Y, Z)
YP = Y3DPOS (X, Y, Z)
ZP = Z3DPOS (X, Y, Z)
REL3PT
The routine REL3PT converts user coordinates to plot coordinates.
XP = X3DREL (X, Y, Z)
YP = Y3DREL (X, Y, Z)
ABS3PT
The routine ABS3PT converts absolute 3-D coordinates to plot coordinates.
The next routines define 3-D base transformations which are applied to 3-D plot routines. The trans-
formations can be combined in any order, but note that matrix multiplications are not commutative.
Different orders may give different results.
TR3SHF
The routine TR3SHF defines a shifting of user 3-D coordinates.
171
or: void tr3shf (float xshf, float yshf, float zshf);
XSHF, YSHF, ZSHF are user coordinates that define the magnitude of shifting in X-, Y- and Z-
direction
TR3SCL
The routine TR3SCL defines a scaling of user 3-D coordinates.
TR3ROT
The routine TR3ROT defines a rotation about an axis. The axes of the 3-D box are used as rotation axes
where the origin of the axis system is located in the centre of the 3-D box (see Figure 12.1).
TR3RES
The routine TR3RES resets 3-D transformations.
172
12.22 Examples
PROGRAM EXA12_1
DIMENSION IXP(4),IYP(4)
DATA IXP/200,1999,1999,200/ IYP/2600,2600,801,801/
EXTERNAL ZFUN
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL AXSPOS(200,2600)
CALL AXSLEN(1800,1800)
CALL NAME(’X-axis’,’X’)
CALL NAME(’Y-axis’,’Y’)
CALL NAME(’Z-axis’,’Z’)
CALL TITLIN(’Surface Plot (SURFUN)’,2)
CALL TITLIN(’F(X,Y) = 2*SIN(X)*SIN(Y)’,4)
CALL GRAF3D(0.,360.,0.,90.,0.,360.,0.,90.,
* -3.,3.,-3.,1.)
CALL HEIGHT(50)
CALL TITLE
CALL SHLSUR
CALL SURFUN(ZFUN,1,10.,1,10.)
FUNCTION ZFUN(X,Y)
FPI=3.14159/180.
ZFUN=2*SIN(X*FPI)*SIN(Y*FPI)
END
173
Figure 12.1: Surface Plot
174
PROGRAM EXA12_2
CHARACTER*60 CTIT1,CTIT2
EXTERNAL ZFUN
CALL SETPAG(’DA4P’)
CALL METAFL(’POST’)
CALL DISINI
CALL HWFONT
CALL PAGERA
CALL AXSPOS(200,2400)
CALL AXSLEN(1800,1800)
CALL INTAX
CALL TITLIN(CTIT1,2)
CALL TITLIN(CTIT2,4)
CALL NAME(’X-axis’,’X’)
CALL NAME(’Y-axis’,’Y’)
CALL NAME(’Z-axis’,’Z’)
CALL VKYTIT(-300)
CALL GRAF3D(-4.,4.,-4.,1.,-4.,4.,-4.,1.,-3.,3.,-3.,1.)
CALL HEIGHT(40)
CALL TITLE
CALL SURMSH(’ON’)
STEP=2*PI/30.
CALL SURFCP(ZFUN,0.,2*PI,STEP,0.,2*PI,STEP)
CALL DISFIN
END
FUNCTION ZFUN(X,Y,IOPT)
IF(IOPT.EQ.1) THEN
ZFUN=COS(X)*(3+COS(Y))
ELSE IF(IOPT.EQ.2) THEN
ZFUN=SIN(X)*(3+COS(Y))
ELSE
ZFUN=SIN(Y)
END IF
END
175
Surface Plot of the Parametric Function
[COS(t)*(3+COS(u)), SIN(t)*(3+COS(u)), SIN(u)]
176
PROGRAM EXA12_3
PARAMETER (N=18)
DIMENSION XRAY(N),YRAY(N),Z1RAY(N),Z2RAY(N),XWRAY(N),
* YWRAY(N),ICRAY(N)
CHARACTER*80 CBUF
DATA XRAY/1., 3., 8., 1.5, 9., 6.3, 5.8, 2.3, 8.1, 3.5,
* 2.2, 8.7, 9.2, 4.8, 3.4, 6.9, 7.5, 3.8/
DATA YRAY/5., 8., 3.5, 2., 7., 1.,4.3, 7.2, 6.0, 8.5,
* 4.1, 5.0, 7.3, 2.8, 1.6, 8.9, 9.5, 3.2/
DATA Z1RAY/0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
* 0., 0., 0., 0., 0., 0., 0., 0./
DATA Z2RAY/4.,5.,3.,2.,3.5,4.5,2.,1.6,3.8,4.7,
* 2.1, 3.5, 1.9, 4.2, 4.9, 2.8
DATA ICRAY/30, 30, 30, 30, 30, 30, 100, 100, 100, 100,
* 100, 100, 170, 170, 170, 170, 170, 170/
DO I=1,N
XWRAY(I)=0.5
YWRAY(I)=0.5
END DO
CALL SETPAG(’DA4P’)
CALL METAFL(’PS’)
CALL DISINI
CALL PAGERA
CALL HWFONT
CALL AXSPOS(200,2600)
CALL AXSLEN(1800,1800)
CALL NAME(’X-axis’,’X’)
CALL NAME(’Y-axis’,’Y’)
CALL NAME(’Z-axis’,’Z’)
CALL TITLIN(’3-D Bars / BARS3D’,3)
CALL LABL3D(’HORI’)
CALL GRAF3D(0.,10.,0.,2.,0.,10.,0.,2.,0.,5.,0.,1.)
CALL GRID3D(1,1,’BOTTOM’)
CALL BARS3D(XRAY,YRAY,Z1RAY,Z2RAY,XWRAY,YWRAY,ICRAY,N)
CALL LEGINI(CBUF,3,20)
CALL LEGTIT(’ ’)
CALL LEGPOS(1300,1100)
CALL LEGLIN(CBUF,’First’,1)
CALL LEGLIN(CBUF,’Second’,2)
CALL LEGLIN(CBUF,’Third’,3)
CALL LEGEND(CBUF,3)
CALL HEIGHT(50)
CALL TITLE
CALL DISFIN
END
177
3-D Bars / BARS3D
First
Second
5.0 Third
4.0
3.0
Z - ax i s
2.0
1.0
10.0
0.0
0.0 8.0
2.0 6.0
4.0 4.0 is
x
X- -a
axi 6.0 2.0 Y
s 8.0
10.0 0.0
178
Chapter 13
This chapter presents different methods to project geographical coordinates onto a plane surface. Several
base maps are stored in DISLIN for plotting maps.
The call is: CALL GRAFMP (XA, XE, XOR, XSTP, YA, YE, YOR, YSTP)
or: void grafmp (float xa, float xe, float xor, float xstp,
float ya, float ye, float yor, float ystp);
XA, XE are the lower and upper limits of the X-axis.
XOR, XSTP are the first X-axis label and the step between labels.
YA, YE are the lower and upper limits of the Y-axis.
YOR, YSTP are the first Y-axis label and the step between labels.
Additional notes: - GRAFMP must be called from level 1 and sets the level to 2.
- The axes must be linear and scaled in ascending order. In general, X-axes
must be scaled between -180 and 180 degrees and Y-axes between -90 and 90
degrees.
- For elliptical projections, the plotting of an axis system will be suppressed.
This will also be done for azimuthal projections with YE - YA > 90.
- The statement CALL GRIDMP (I, J) overlays an axis system with a longitude
and latitude grid where I and J are the number of grid lines between labels in
the X- and Y-direction.
XAXMAP
The routine XAXMAP plots a secondary X-axis.
The call is: CALL XAXMAP (A, B, OR, STEP, CSTR, NT, NY) level 2
or: void xaxmap (float a, float b, float or, float step, char *cstr, int nt, int ny);
A, B are the lower and upper limits of the X-axis.
OR, STEP are the first label and the step between labels.
179
CSTR is a character string containing the axis name.
NT indicates how ticks, labels and the axis name are plotted. If NT = 0, they
are plotted in a clockwise direction. If NT = 1, they are plotted in a counter-
clockwise direction.
NY defines the horizontal position of the X-axis. A secondary axis must be located
inside the axis system.
YAXMAP
The routine YAXMAP plots a secondary Y-axis.
The call is: CALL YAXMAP (A, B, OR, STEP, CSTR, NT, NX) level 2
or: void yaxmap (float a, float b, float or, float step, char *cstr, int nt, int nx);
A, B are the lower and upper limits of the Y-axis.
OR, STEP are the first label and the step between labels.
CSTR is a character string containing the axis name.
NT indicates how ticks, labels and the axis name are plotted. If NT = 0, they
are plotted in a clockwise direction. If NT = 1, they are plotted in a counter-
clockwise direction.
NX defines the vertical position of the Y-axis. A secondary axis must be located
inside the axis system.
a) Cylindrical Projections
The surface of the globe is projected onto a cylinder which can be unfolded into a plane
surface and touches the globe at the equator. The latitudes and longitudes of the globe are
projected as straight lines.
b) Conical Projections
The surface of the globe is projected onto a cone which can also be unfolded into a plane
surface. The cone touches or intersects the globe at two latitudes. The longitudes are
projected as straight lines intersecting at the top of the cone and the latitudes are projected
as concentric circles around the top of the cone.
c) Azimuthal Projections
For azimuthal projections, a hemisphere is projected onto a plane which touches the hemi-
sphere at a point called the map pole. The longitudes and latitudes are projected as circles.
d) Elliptical Projections
Elliptical projections project the entire surface of the globe onto an elliptical region.
180
PROJCT
The routine PROJCT selects the geographical projection.
181
If YE - YA ≤ 90, the part of the globe defined by the axis scaling is pro-
jected onto a rectangle. The map pole will be set by GRAFMP to ((XA+XE)/2,
(YE+YA)/2). The scaling parameters must be in the range:
-180 ≤ XA ≤ XE ≤ 180 and
XE - XA ≤ 180
- 90 ≤ YA ≤ YE ≤ 90
- For all projections except the default projection, longitude and latitude coordi-
nates will be projected with the same scaling factor for the X- and Y-axis. The
scaling factor is determined by the scaling of the Y-axis while the scaling of
the X-axis is used to centre the map. The longitude (XA+XE)/2 always lies in
the centre of the axis system.
- Geographical projections can only be used for routines described in this chap-
ter or routines that plot contours.
SHDMAP
The routine SHDMAP plots shaded continents.
SHDAFR
182
The call is: CALL SHDAFR (INRAY, IPRAY, ICRAY, N) level 2
or: void shdafr (int *inray, long *ipray, int *icray, int n);
INRAY is an integer array containing the countries to be shaded. INRAY can have the
following values:
SHDASI
183
13: India 31: Oman 49: Westbank
14: Indonesia 32: Pakistan 50: Yemen
15: Iran 33: Paracel
16: Iraq 34: Philippines
17: Israel 35: Quatar
18: Japan 36: Russia 0: All
SHDAUS
The routine SHDAUS plots shaded countries of Australia and Oceania.
SHDEUR
The routine SHDEUR plots shaded European countries.
184
10: France 26: Sweden 42: Russia
11: Greece 27: Switzerland 43: Serbia
12: Ireland 28: Spain 44: Slovakia
13: Iceland 29: CSFR 45: Slowenia
14: Italy 30: Turkey 46: Ukraine
15: Yugoslavia 31: USSR
16: Liechtenstein 32: Hungary 0: All
SHDNOR
The routine SHDNOR plots shaded countries of North and Central Amerika.
SHDSOU
185
INRAY is an integer array containing the states to be shaded. INRAY can have the
following values:
SHDUSA
186
The call is: CALL CURVMP (XRAY, YRAY, N) level 2
or: void curvmp (float *xray, float *yray, int n);
XRAY, YRAY are real arrays containing the data points.
N is the number of data points.
Additional notes: - CURVMP is similar to CURVE except that only a linear interpolation can be
used.
- In general, a line between two points on the globe will not be projected as a
straight line. Therefore, CURVMP interpolates lines linearly by small steps.
Alternate plotting modes can be set with MAPMOD.
ftp://ftp.ngdc.noaa.gov/MGG/shorelines/
ftp://gmt.soest.hawaii.edu/pub/wessel/gshhs/.
The external map files ’gshhs l.b’, ’gshhs i.b’, ’gshhs h.b’ and ’gshhs f.b’ must be copied to the map
subdirectory of the DISLIN directory, or the name of the map file must be specified with the routine
MAPFIL.
Map files in Mapgen format are available from the Coastline Extractor:
http://rimmer.ngdc.noaa.gov/
MAPFIL
The routine MAPFIL defines an external map file. The map file can be used as base map if the routine
MAPBAS is called with the parameter ’MAPFIL’.
187
COPT is a character string describing the format of the map coordinates. COPT can
have the values ’GSHHS’ and ’MAPGEN’.
MAPLEV
The routine MAPLEV defines land or lake coordinates for WORLD if the external map files from Paul
Wessel are used.
MAPPOL
MAPPOL defines the map pole used for azimuthal projections.
The call is: CALL MAPPOL (XPOL, YPOL) level 1
or: void mappol (float xpol, float ypol);
XPOL, YPOL are the longitude and latitude coordinates in degrees where:
-180 ≤ XPOL ≤ 180 and -90 ≤ YPOL ≤ 90.
Default: (0., 0.)
Additional note: For an azimuthal projection with YE - YA ≤ 90, the map pole will be set by
GRAFMP to ((XA+XE)/2, (YA+YE)/2).
MAPSPH
For an azimuthal projection with YE - YA > 90, DISLIN automatically projects a hemisphere around
the map pole onto a circle. The hemisphere can be reduced using MAPSPH.
MAPREF
The routine MAPREF defines, for conical projections, two latitudes where the cone intersects or touches
the globe.
The call is: CALL MAPREF (YLW, YUP) level 1
or: void mapref (float ylw, float yup);
YLW, YUP are the lower and upper latitudes where:
0 ≤ YLW ≤ YUP ≤ 90 or - 90 ≤ YLW ≤ YUP ≤ 0
Default: YLW = YA + 0.25 * (YE - YA)
YUP = YA + 0.75 * (YE - YA)
Additional note: YLW and YUP can have identical values and lie outside of the axis scaling.
MAPLAB
The routine MAPLAB enables axis system labels for azimuthal and elliptical projections.
188
The call is: CALL MAPLAB (COPT, CKEY) level 1, 2
or: void maplab (char *copt, char *ckey);
COPT is a character string that can contain the options ’NONE’, ’LEFT’, ’RIGHT’
and ’BOTH’.
CKEY is a character string containing the keyword ’LATITUDE’.
Default: (’NONE’, ’LATITUDE’).
MAPMOD
The routine MAPMOD determines how data points will be connected by CURVMP.
The call is: CALL MAPMOD (CMODE) level 1, 2
or: void mapmod (char *cmode);
CMODE is a character string defining the connection mode.
= ’STRAIGHT’ defines straight lines.
= ’INTER’ means that lines will be interpolated linearly.
= ’GREAT’ means Great Circle interpolation.
Default: CMODE = ’INTER’.
MAPOPT
The routine MAPOPT enables political borders plotted by the routine WORLD, or sets an option to
adjust the length of the X-axis to the scaling.
The call is: CALL MAPOPT (COPT, CKEY) level 1, 2
or: void mapopt (char *copt, char *ckey);
COPT is a character string containing an option.
CKEY is a character string containing a keyword:
= ’WORLD’ If CKEY = ’WORLD’, COPT can have the values ’COAST’, ’BORDERS’
and ’BOTH’. The default value is COPT = ’COAST’.
= ’XAXIS’ If CKEY = ’XAXIS’, COPT can have the values ’STANDARD’ and ’AUTO’.
Normally, longitude and latitude coordinates will be projected with the same
scaling factor where the scaling factor is determined by the scaling of the Y-
axis while the scaling of the X-axis is used to centre the map. For COPT =
’AUTO’, DISLIN tries the change the length of the X-axis, so that the axis
length corresponds to the scaling parameters in GRAFMP for the X-axis. The
default value is COPT = ’STANDARD’.
189
13.7 User-defined Projections
An user-defined projection can be enabled with the keyword ’MYPR’ in the routine PROJCT. For a
user-defined projection, the user must write a routine that converts longitude and latitude coordinates to
axis coordinates (plot coordinates relative to the origin of the axis system). The name of the user written
routine must then passed to DISLIN with the routine SETCBK.
SETCBK
The routine SETCBK defines a user written callback routine.
The call is: CALL SETCBK (ROUTINE, ’MYPR’) level 0, 1, 2, 3
or: void setcbk (void (*routine)(float *xp, float *yp), ”MYPR”);
ROUTINE is the name of a routine defined by the user. In Fortran, the routine must be
declared as EXTERNAL.
PROGRAM MYPR
EXTERNAL MYFUNC
COMMON /MYCOMM/ XA,XE,YA,YE,NXL,NYL
XA = -180.
XE = 180.
YA = -90.
YE = 90.
NXL = 2400
NYL = 1200
CALL GRAFMP (XA, XE, XA, 90., YA, YE, YA, 30.)
CALL GRIDMP (1,1)
CALL WORLD
CALL DISFIN
END
190
13.8 Examples
PROGRAM EX13_1
CALL SETPAG(’DA4L’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL FRAME(3)
CALL AXSPOS(400,1850)
CALL AXSLEN(2400,1400)
CALL NAME(’Longitude’,’X’)
CALL NAME(’Latitude’,’Y’)
CALL TITLIN(’World Coastlines and Lakes’,3)
CALL LABELS(’MAP’,’XY’)
CALL GRAFMP(-180.,180.,-180.,90.,-90.,90.,-90.,30.)
CALL GRIDMP(1,1)
CALL WORLD
CALL HEIGHT(50)
CALL TITLE
CALL DISFIN
END
191
Figure 13.1: World Coastlines and Lakes
192
PROGRAM EX13_2
CHARACTER*6 CPROJ(3),CTIT*60
DATA CPROJ/’Sanson’,’Winkel’,’Hammer’/
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL HEIGHT(40)
CALL AXSLEN(1600,750)
NYA=3850
DO I=1,3
NYA=NYA-950
CALL AXSPOS(250,NYA)
CALL PROJCT(CPROJ(I))
CALL NOCLIP
CALL GRAFMP(-180.,180.,-180.,30.,-90.,90.,-90.,15.)
CALL WORLD
CALL GRIDMP(1,1)
CALL ENDGRF
END DO
CALL DISFIN
END
193
Figure 13.2: Elliptical Projections
194
PROGRAM EX13_3
DIMENSION NXA(4),NYA(4),XPOL(4),YPOL(4)
CHARACTER*60 CTIT
DATA NXA/200,1150,200,1150/NYA/1600,1600,2700,2700/
DATA XPOL/0.,0.,0.,0./YPOL/0.,45.,90.,-45./
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL HEIGHT(50)
NL=NLMESS(CTIT)
NX=(2250-NL)/2.
CALL MESSAG(CTIT,NX,300)
CALL AXSLEN(900,900)
CALL PROJCT(’LAMBERT’)
DO I=1,4
CALL AXSPOS(NXA(I),NYA(I))
CALL MAPPOL(XPOL(I),YPOL(I))
CALL GRAFMP(-180.,180.,-180.,30.,-90.,90.,-90.,30.)
CALL WORLD
CALL GRIDMP(1,1)
CALL ENDGRF
END DO
CALL DISFIN
END
195
Figure 13.3: Azimuthal Lambert Projections
196
PROGRAM EX13_4
PARAMETER (N = 32)
DIMENSION INRAY(1),IPRAY(1),ICRAY(1)
INRAY(1)=0
IPRAY(I)=0
ICRAY(I)=255
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL INTAX
CALL TICKS(1,’XY’)
CALL FRAME(3)
CALL AXSLEN(1600,2200)
CALL AXSPOS(400,2700)
CALL NAME(’Longitude’,’X’)
CALL NAME(’Latitude’,’Y’)
CALL TITLIN(’Conformal Conic Projection’,3)
CALL LABELS(’MAP’,’XY’)
CALL PROJCT(’CONF’)
CALL GRAFMP(-10.,30.,-10.,5.,35.,70.,35.,5.)
CALL GRIDMP(1,1)
CALL SHDEUR(INRAY,IPRAY,ICRAY,N)
CALL HEIGHT(50)
CALL TITLE
CALL DISFIN
END
197
Conformal Conic Projection
65o N
60o N
55o N
Latitude
50o N
45o N
40o N
35o N
198
Chapter 14
Contouring
This chapter describes routines for contouring three-dimensional functions of the form Z = F(X,Y).
Contours can be generated with the routine CONPTS or with other software packages and plotted with
the routine CONCRV or can be calculated and plotted by DISLIN with the routines CONMAT, CONTUR
and CONSHD.
CONCRV
CONCRV plots contours generated by other software packages.
XRAY, YRAY are arrays containing the X- and Y-coordinates of a contour line.
N is the number of points.
ZLEV is a function value used for labels.
CONTUR
The routine CONTUR calculates and plots contours of the function Z = F(X,Y).
199
CONMAT
The routine CONMAT plots contours of the function Z = F(X,Y). The function values correspond to a
linear grid in the XY-plane.
The call is: CALL CONMAT (ZMAT, N, M, ZLEV) level 2, 3
or: void conmat (float *zmat, int n, int m, float zlev);
ZMAT is a matrix of the dimension (N, M) containing the function values. If XA,
XE, YA and YE are the axis limits in GRAF or values defined with the routine
SURSZE, the connection of grid points and matrix elements can be described
by the formula:
ZMAT(I,J) = F(X,Y) where
X = XA + (I - 1) * (XE - XA) / (N - 1) , I = 1,..,N and
Y = YA + (J - 1) * (YE - YA) / (M - 1) , J = 1,..,M.
N, M define the dimension of ZMAT.
ZLEV is a function value that defines the contour line to be calculated. The value can
be used for labels.
Additional notes: - CONCRV, CONTUR and CONMAT use linear interpolation to connect con-
tour points. The routine TRFMAT can be used to pass a matrix with a better
resolution to CONTUR and CONMAT.
- Geographical projections can be defined for contouring.
- The thickness of contours can be set with THKCRV. Line styles and colours
can also be defined. Legends are supported for filled and non-filled contours.
- The number of matrix points in CONTUR and CONMAT is limited to N * M
≤ 256000 in Fortran 77. There is no limit for the C and Fortran 90 libraries of
DISLIN.
- To plot contours for randomly distributed points of the form X(N), Y(N) and
Z(N), the routine GETMAT can be used to calculate a function matrix, or the
data can be triangulated with the routine TRIANG and contours can be plotted
from the triangulation with the routine CONTRI.
CONTRI
The routine CONTRI plots contours from triangulated data that can be calculated by the routine TRIANG
from a set of irregularily distributed data points.
The call is: CALL CONTRI (XRAY, YRAY, ZRAY, N, I1RAY, I2RAY, I3RAY, NTRI,
ZLEV) level 2, 3
or: void contri (float *xray, float *yray, float *zray, int n,
int *i1ray, int *i2ray, int *i3ray, int ntri, float zlev);
XRAY is an array containing the X-coordinates of data points.
YRAY is an array containing the Y-coordinates of data points.
ZRAY is an array containing the Z-coordinates of data points.
N is the number of data points.
I1RAY, I2RAY, I3RAY is the Delaunay triangulation of the points (XRAY, YRAY) calculated by the
routine TRIANG.
NTRI is the number of triangles in I1RAY, I2RAY and I3RAY.
ZLEV is a function value that defines the contour line to be calculated.
200
14.2 Plotting Filled Contours
CONSHD
The routine CONSHD plots filled contours of the function Z = F(X,Y). Two algorithms can be selected
for contour filling: a cell filling algorithm and a polygon filling algorithm. For a polygon filling, only
closed contours can be filled. The algorithm can be defined with the routine SHDMOD.
The call is: CALL CONSHD (XRAY, N, YRAY, M, ZMAT, ZLVRAY, NLV)
level 2, 3
or: void conshd (float *xray, int n, float *yray, int m, float *zmat, float *zlvray,
int nlv);
XRAY is an array containing X-coordinates.
N is the dimension of XRAY.
YRAY is an array containing Y-coordinates.
M is the dimension of YRAY.
ZMAT is a matrix of the dimension (N, M) containing function values.
ZLVRAY is an array containing the levels. For polygon filling, the levels should be sorted
in such a way that inner contours are plotted last.
NLV is the number of levels.
Additional notes: - CONSHD may give better results for a higher resolution of ZMAT. A matrix
with a higher resolution can be calculated with the routine TRFMAT.
- The colours of the filled contours are calculated from a fictive colour bar where
the minimum and maximum of the contour levels are used for the lower and
upper limits of the colour bar. The scaling of the colour bar can be modified
with the routine ZSCALE while a colour bar can be displayed with the routine
ZAXIS. If the colours of the filled contours should not be calculated from a
colour bar, they can be defined directly with the routine CONCLR.
- For a cell filling, the calculation of contour colours are described in the fol-
lowing. The levels are sorted first in ascending order. By default, the colour of
the region between two neighbouring levels is calculated from the lower value
of the two levels. If you want to use the upper value, you can define it with
the routine SHDMOD (’UPPER’, ’COLOUR’). In default mode (SHDMOD
(’LOWER’, ’COLOUR’), the cells below the mimimum of the levels are filled
with the lowermost colour of the colour bar, the cells above the maximum of
the levels are filled with the uppermost colour of the colour bar. The plotting of
this regions can be suppressed with the statement CALL SHDMOD (’NONE’,
’CELL’).
CONFLL
The routine CONFLL plots filled contours from triangulated data that can be calculated by the routine
TRIANG from a set of irregularily distributed data points.
The call is: CALL CONFLL (XRAY, YRAY, ZRAY, N, I1RAY, I2RAY, I3RAY, NTRI,
ZLVRAY, NLV) level 2, 3
or: void confll (float *xray, float *yray, float *zray, int n,
int *i1ray, int *i2ray, int *i3ray, int ntri, float *zlvray, int nlv);
XRAY is an array containing the X-coordinates of data points.
YRAY is an array containing the Y-coordinates of data points.
201
ZRAY is an array containing the Z-coordinates of data points.
N is the number of data points.
I1RAY, I2RAY, I3RAY is the Delaunay triangulation of the points (XRAY, YRAY) calculated by the
routine TRIANG.
NTRI is the number of triangles in I1RAY, I2RAY and I3RAY.
ZLVRAY is an array containing the levels.
NLV is the number of levels.
Additional note: See the notes for CONSHD.
The call is: CALL CONPTS (XRAY, N, YRAY, M, ZMAT, ZLEV, XPTRAY, YPTRAY,
MAXPTS, IRAY, MAXCRV, NCURVS) level 0, 1, 2, 3
or: void conpts (float *xray, int n, float *yray, int m, float *zmat, float zlev,
float *xptray, float *yptray, int maxpts, int *iray, int maxray, int *ncurvs);
XRAY is an array containing X-coordinates.
N is the dimension of XRAY.
YRAY is an array containing Y-coordinates.
M is the dimension of YRAY.
ZMAT is a matrix of the dimension (N, M) containing function values.
ZLEV is a function value that defines the contour line to be calculated.
XPTRAY, YPTRAY are returned arrays containing the calculated contour. The arrays can contain
several curves.
MAXPTS is the maximal number of points that can be passed to XPTRAY and YPTRAY.
IRAY is a returned integer array that contains the number of points for each generated
contour curve.
MAXCRV is the maximal number of entries that can be passed to IRAY.
NCURVS is the returned number of generated curves.
Example:
The following statements generate from some arrays XRAY, YRAY and ZMAT contours and plot them
with the routine CURVE.
202
DO J=1,NCURVS
CALL CURVE(XPTS(K),YPTS(K),IRAY(J))
K=K+IRAY(J)
END do
END DO
TRIPTS
The routine TRIPTS generates contours from triangulated data without plotting. Multiple curves can be
returned for one contour level.
The call is: CALL TRIPTS (XRAY, YRAY, ZRAY, N, I1RAY, I2RAY, I3RAY, NTRI,
ZLEV, XPTRAY, YPTRAY, MAXPTS, IRAY, MAXCRV, NCURVS)
level 0, 1, 2, 3
or: void tripts (float *xray, float *yray, float *zray, int n, int *i1ray, int *i2ray,
int *i3ray, int ntri, float zlev, float *xptray, float *yptray, int maxpts,
int *iray, int maxray, int *ncurvs);
XRAY is an array containing the X-coordinates of data points.
YRAY is an array containing the Y-coordinates of data points.
ZRAY is an array containing the Z-coordinates of data points.
N is the number of data points.
I1RAY, I2RAY, I3RAY is the Delaunay triangulation of the points (XRAY, YRAY) calculated by the
routine TRIANG.
NTRI is the number of triangles in I1RAY, I2RAY and I3RAY.
ZLEV is a function value that defines the contour line to be calculated.
XPTRAY, YPTRAY are returned arrays containing the calculated contour. The arrays can contain
several curves.
MAXPTS is the maximal number of points that can be passed to XPTRAY and YPTRAY.
IRAY is a returned integer array that contains the number of points for each generated
contour curve.
MAXCRV is the maximal number of entries that can be passed to IRAY.
NCURVS is the returned number of generated curves.
203
Additional note: The number of decimal places in contour labels can be defined with CALL
LABDIG (NDIG, ’CONTUR’). The default value for NDIG is 1.
LABDIS
The routine LABDIS defines the distance between contour labels.
LABCLR
The routine LABCLR defines the colour of contour labels.
CONLAB
The routine CONLAB defines a character string which will be used for labels if the routine LABELS is
called with the parameter ’CONLAB’.
CONMOD
The routine CONMOD modifies the appearance of contour labels. By default, DISLIN suppresses the
plotting of labels at a position where the contour is very curved. To measure the curvature of a contour
for an interval, DISLIN calculates the ratio between the arc length and the length of the straight line
between the interval limits. If the quotient is much greater than 1, the contour line is very curved in that
interval.
CONGAP
The routine CONGAP defines the distance between contour lines and labels.
204
or: void congap (float xfac);
XFAC is a real number used as a scaling factor. The distance between contour lines
and labels is set to XFAC * NH where NH is the current character height.
Default: XFAC = 0.5.
SHDMOD
The routine SHDMOD selects the algorithm used for contour filling, or modifies options for cell filling.
CONCLR
The routine CONCLR defines colours for filled contour lines.
205
14.5 Examples
PROGRAM EX14_1
PARAMETER (N=100)
DIMENSION X(N),Y(N),Z(N,N)
FPI=3.14159/180.
STEP=360./(N-1)
DO I=1,N
X(I)=(I-1.)*STEP
Y(I)=(I-1.)*STEP
END DO
DO I=1,N
DO J=1,N
Z(I,J)=2*SIN(X(I)*FPI)*SIN(Y(J)*FPI)
END DO
END DO
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL INTAX
CALL AXSPOS(450,2670)
CALL GRAF(0.,360.,0.,90.,0.,360.,0.,90.)
CALL HEIGHT(30)
DO I=1,9
ZLEV=-2.+(I-1)*0.5
IF(I.EQ.5) THEN
CALL LABELS(’NONE’,’CONTUR’)
ELSE
CALL LABELS(’FLOAT’,’CONTUR’)
END IF
CALL CONTUR(X,N,Y,N,Z,ZLEV)
END DO
CALL HEIGHT(50)
CALL TITLE
CALL DISFIN
END
206
Figure 14.1: Contour Plot
207
PROGRAM EX14_2
PARAMETER (N=100)
DIMENSION ZMAT(N,N)
STEP=1.2/(N-1)
DO I=1,N
X=0.4+(I-1)*STEP
DO J=1,N
Y=0.4+(J-1)*STEP
ZMAT(I,J)=(X**2.-1.)**2. + (Y**2.-1.)**2.
END DO
END DO
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL MIXALF
CALL TITLIN(’Contour Plot’,1)
CALL TITLIN(’F(X,Y) = (X[2$ - 1)[2$ + (Y[2$ - 1)[2$’,3)
CALL NAME(’X-axis’,’X’)
CALL NAME(’Y-axis’,’Y’)
CALL AXSPOS(450,2670)
CALL GRAF(0.4,1.6,0.4,0.2,0.4,1.6,0.4,0.2)
DO I=1,12
ZLEV=0.1+(I-1)*0.1
IF(MOD(I,3).EQ.1) THEN
CALL SOLID
CALL THKCRV(3)
ELSE IF(MOD(I,3).EQ.2) THEN
CALL DASH
CALL THKCRV(1)
ELSE
CALL DOT
CALL THKCRV(1)
END IF
CALL CONMAT(ZMAT,N,N,ZLEV)
END DO
CALL HEIGHT(50)
CALL TITLE
CALL DISFIN
END
208
Figure 14.2: Contour Plot
209
PROGRAM EX14_3
PARAMETER (N=100)
DIMENSION ZMAT(N,N),XRAY(N),YRAY(N),ZLEV(12)
STEP=1.6/(N-1)
DO I=1,N
XRAY(I)=0.0+(I-1)*STEP
DO J=1,N
YRAY(J)=0.0+(J-1)*STEP
ZMAT(I,J)=(XRAY(I)**2.-1.)**2. +
* (YRAY(J)**2.-1.)**2.
END DO
END DO
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL MIXALF
CALL TITLIN(’Shaded Contour Plot’,1)
CALL TITLIN(’F(X,Y) = (X[2$ - 1)[2$ + (Y[2$ - 1)[2$’,3)
CALL NAME(’X-axis’,’X’)
CALL NAME(’Y-axis’,’Y’)
CALL SHDMOD(’POLY’,’CONTUR’)
CALL AXSPOS(450,2670)
CALL GRAF(0.0,1.6,0.0,0.2,0.0,1.6,0.0,0.2)
DO I=1,12
ZLEV(13-I)=0.1+(I-1)*0.1
END DO
CALL CONSHD(XRAY,N,YRAY,N,ZMAT,ZLEV,12)
CALL HEIGHT(50)
CALL TITLE
CALL DISFIN
END
210
Shaded Contour Plot
F(X,Y) = (X2 - 1)2 + (Y2 - 1) 2
1.6
1.4
1.2
1.0
Y-axis
0.8
0.6
0.4
0.2
0.0
0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6
X-axis
211
212
Chapter 15
Widget Routines
DISLIN offers some routines for creating graphical user interfaces in Fortran and C programs. The
routines are called widget routines and use the Motif widget libraries on X11 and the API functions on
Windows systems.
There are sets of routines in DISLIN for creating single widgets, for setting parameters, for requesting
current widget values selected by the user and for creating dialogs.
Routines for creating single widgets begin with the characters ’WG’, parameter setting routines with the
characters ’SWG’, requesting routines with the characters ’GWG’ and dialog routines with the characters
’DWG’.
Normally, creating widget and parameter setting routines should be used between the routines WGINI
and WGFIN while requesting routines can be called after WGFIN, or in a callback routine. Dialog
routines can be used independently from the routines WGINI and WGFIN.
COPT is a character string that defines how children widgets are laid out in the main
widget:
= ’VERT’ means that children widgets are laid out in columns from top to bottom.
= ’HORI’ means that children widgets are laid out in rows from left to right.
= ’FORM’ means that the position and size of children widgets is defined by the user with
the routines SWGPOS, SWGSIZ and SWGWIN.
ID is the returned widget index. It can be used as a parent widget index in other
widget calls.
WGFIN
WGFIN terminates the widget routines. The widgets will be displayed on the screen. After choosing
OK in the Exit menu, all widgets are deleted and the program is continued after WGFIN. After choosing
Quit in the Exit menu, the program is terminated.
213
WGBAS
The routine WGBAS creates a container widget. It can be used as a parent widget for other widgets.
WGPOP
The routine WGPOP creates a popup menu in the menubar of the main widget, or a popup submenu of a
pop umenu. Entries in the popup menu must be created with WGAPP.
WGAPP
The routine WGAPP creates an entry in a popup menu. The popup menu must be created with the routine
WGPOP.
WGLAB
The routine WGLAB creates a label widget. The widget can be used to display a character string.
WGBUT
The routine WGBUT creates a button widget. The widget represents a labeled button that the user can
turn on or off by clicking.
214
The call is: CALL WGBUT (IP, CLAB, IVAL, ID)
or: int wgbut (int ip, char *clab, int ival);
IP is the index of the parent widget.
CLAB is a character string that will be used as a label.
IVAL can have the values 0 (off) and 1 (on) and is used to initialize the button.
ID is the returned widget index.
WGSTXT
The routine WGSTXT creates a scrolled widget that can be used for text output. The text cannot not be
modified. Text entries in the widget can be made with the routine SWGTXT.
The call is: CALL WGSTXT (IP, NSIZE, NMAX, ID)
or: int wgtxt (int ip, int nsize, int nmax);
IP is the index of the parent widget.
NSIZE defines the vertical size of the widget in text rows.
NMAX defines the maximal number of displayed entries in the scrolled widget. If this
number is reached and a new entry is made, the first entry in the widget is
deleted.
ID is the returned widget index.
WGTXT
The routine WGTXT creates a text widget. The widget can be used to get text from the keyboard.
The call is: CALL WGTXT (IP, CSTR, ID)
or: int wgtxt (int ip, char *cstr);
IP is the index of the parent widget.
CSTR is a character string that will be displayed in the text widget (≤ 256 characters).
ID is the returned widget index.
WGLTXT
The routine WGLTXT creates a labeled text widget. The widget can be used to get text from the key-
board.
The call is: CALL WGLTXT (IP, CLAB, CSTR, NWTH, ID)
or: int wgltxt (int ip, char *clab, char *cstr, int nwth);
IP is the index of the parent widget.
CLAB is a character string containing a label. It will be displayed on the left side of
the widget.
CSTR is a character string that will be displayed in the text widget (≤ 256 characters).
NWTH defines the width of the text field (0 ≤ NWTH ≤ 100). For example, NWTH
= 30 means that the width of the text field is: 0.3 * widget width.
ID is the returned widget index.
WGFIL
The routine WGFIL creates a file widget. The widget can be used to get a filename from the keyboard.
The filename can be typed directly into the file field or can be selected from a file selection box if an
entry in the File menu is chosen.
215
The call is: CALL WGFIL (IP, CLAB, CFIL, CMASK, ID)
or: int wgfil (int ip, char *clab, char *cfil, char *cmask);
IP is the index of the parent widget.
CLAB is a character string used for an entry in the File menu.
CFIL is a character string that will be displayed in the file widget (≤ 256 characters).
CMASK specifies the search pattern used in determining the files to be displayed in the
file selection box.
ID is the returned widget index.
WGLIS
The routine WGLIS creates a list widget. This widget is used whenever an application must present a
list of names from which the user can choose.
WGDLIS
The routine WGDLIS creates a dropping list widget. This list widget can be used to save space in the
parent widget.
WGBOX
The routine WGBOX creates a list widget where the list elements are displayed as toggle buttons.
216
WGSCL
The routine WGSCL creates a scale widget. The widget can be displayed in horizontal or vertical direc-
tion.
The call is: CALL WGSCL (IP, CLAB, XMIN, XMAX, XVAL, NDEZ, ID)
or: int wgscl (int ip, char *clab, float xmin, float xmax, float xval, int ndez);
IP is the index of the parent widget.
CLAB is a character string used for a label.
XMIN is a floating-point value that defines the minimal value of the scale widget.
XMAX is a floating-point value that defines the maximal value of the scale widget.
XVAL defines the value of the scale widget.
NDEZ is the number of digits used in the scale widget.
ID is the returned widget index.
Additional note: A step parameter for scale widgets can be defined with the routine SWGSTP.
WGPBAR
The routine WGPBAR creates progress bars. The widget can be displayed in horizontal or vertical
direction.
The call is: CALL WGPBAR (IP, XMIN, XMAX, XSTP, ID)
or: int wgpbar (int ip, float xmin, float xmax, float xstp);
IP is the index of the parent widget.
XMIN is a floating-point value that defines the minimal value of the progress bar.
XMAX is a floating-point value that defines the maximal value of the progress bar.
XSTP defines the step size. XSTP is used to calculate the maximal number of rectan-
gles in non-smoothed progress bars. XSTP is ignored for smoothed progress
bars.
ID is the returned widget index.
Additional note: The appearance of progress bars can be modified with the routines SWGCLR,
SWGOPT and SWGTYP. The value of progress bars can be set with SWG-
VAL.
WGDRAW
The routine WGDRAW creates a draw widget that can be used for graphical output from DISLIN plotting
routines.
217
- By default, the height of a draw widget is identical width the width of the wid-
get. The height of draw widgets can be modified with the routine SWGDRW.
WGTBL
The routine WGTBL creates a table widget that can be used for data input and output.
WGOK
The routine WGOK creates a push button widget where the button has the same meaning as the OK
entry in the Exit menu. If the button is pressed, all widgets are deleted and the program is continued after
WGFIN.
WGQUIT
The routine WGQUIT creates a push button widget where the button has the same meaning as the QUIT
entry in the Exit menu. If the button is pressed, the program is terminated.
WGPBUT
The routine WGPBUT creates a push button widget.
218
CLAB is a character string that will be used as a label.
ID is the returned widget index. It should be connected with a callback routine.
Additional note: The status of a push button (if it is pressed or not) can be requested with GWG-
BUT.
WGCMD
The routine WGCMD creates a push button widget. A corresponding system command will be executed
if the button is pressed.
SWGDRW
The routine SWGDRW modifies the height of draw widgets.
SWGCLR
The routine SWGCLR defines colours for widgets.
219
Additional notes: - Colours can not be defined for push button widgets. This is a restriction in the
Windows API.
- Multiple draw widgets must have the same background colour since they be-
long to the same widget class. The same is valid for multiple main widgets
created by WGINI.
SWGFNT
The routine SWGFNT defines fonts for widgets.
SWGFOC
The routine SWGFOC sets the keyboard focus to the specified widget.
SWGOPT
The routine SWGOPT sets widget options.
The call is: CALL SWGOPT (COPT, CKEY)
or: void swgopt (char *copt, char *ckey);
COPT is a character string containing an option.
CKEY is a character string containing a keyword:
= ’BORDER’ This keyword defines borders around table cells. COPT can have the values
’NONE’, ’COLUMNS’, ’ROWS’ and ’BOTH’. The default value is ’BOTH’.
= ’CALLBACK’ The behaviour of callback routines for text widgets can be modified with this
keyword. COPT can have the values ’RETURN’, ’CHANGE’ and ’BOTH’.
For ’RETURN’, the callback routine is only called if a return is given in the
text field, for ’CHANGE, the callback routine is called for each change in the
text field. The default value is ’RETURN’.
= ’CLOSE’ This keyword changes the behaviour of the close button of the main widget.
For COPT = ’QUIT’, the program will be terminated. For COPT = ’OK’, the
main widget is deleted and the program is continued after WGFIN.
= ’EDIT’ This keyword defines if table cells are editable or not. COPT can have the
values ’OFF’ and ’ON’.
= ’FRAME’ Enables or disables a frame around table widgets. COPT can have the values
’OFF’ and ’ON’.
220
= ’HEADER’ This keyword enables header cells in table widgets. COPT can have the values
’NONE’, ’COLUMNS’, ’ROWS’ and ’BOTH’.
= ’MASK’ If CKEY = ’MASK’, COPT can have the values ’STANDARD’ and ’USER’.
For COPT = ’USER’, the mask entry in the routines WGFIL and DWGFIL
can be controlled completely by the user. For that case, the mask parameter in
WGFIL and DWGFIL can have the following syntax: it contains of a pair of
strings separated by a ’+’ sign. The first string contains the label, the second
string the search filter. For example: ’Data (*.dat)+*.dat’. ’Data (*.dat)’ is
the label while ’*.dat’ the filter. Multiple pairs of strings for the mask are also
possible.
= ’PBAR’ This option changes the appearance of progress bars. COPT can have the
values ’SMOOTH’, ’NOSMOOTH’, ’BACK’, ’NOBACK’, ’LABEL’,’ NO-
LABEL’, ’FRAME’ and ’NOFRAME’. The defaults are ’NOSMOOTH’,
’BACK’, ’NOLABEL’ and ’FRAME’.
= ’POSITION’ If CKEY = ’POSITION’, COPT can have the values ’STANDARD’ and ’CEN-
TER’. For COPT = ’CENTER’, the main widget will be centered on the screen.
The default position of the main widget is the upper left corner of the screen.
= ’SCROLL’ This option changes the behaviour of callback routines for scroll widgets.
COPT can have the values ’TRACK’, ’BUTTON’ and ’END’. If COPT =
’TRACK’, the callback routine is called for each change of the scroll value.
If COPT = ’BUTTON’, the callback routine is only called if an user releases
the mouse button. For COPT = ’END’, the callback routine is called at the end
of the scroll action.
= ’VERIFY’ The keyword ’VERIFY’ enables a check of input charcters in text and
table cells. COPT can have the values ’NONE’, ’INTEGER’, ’FLOAT’,
’EFLOAT’, ’DFLOAT’, ’ALPHA’, ’NALPHA’, ’EMAIL’, ’TIME’, ’DATE’,
’PHONE’, ’HEXA’ and ’OCTAL’. The default value is COPT = ’NONE’. A
table of the possible chacters correspondig to the verify options is given below.
The following table shows the possible characters for the different ’VERIFY’ options in SWGOPT:
221
NONE all characters
DIGITS 0-9
ALPHA a - z, A - Z, ’ ’
NALPHA a - z, A - Z, 0 - 9, ’ ’
TIME 0 - 9, ’:’
SWGPOP
The routine SWGPOP modifies the appearance of the popup menubar.
SWGTIT
The routine SWGTIT defines a title displayed in the main widget.
SWGHLP
The routine SWGHLP sets a character string that will be displayed if the Help menu is clicked by the
user.
222
or: void swghlp (char *cstr);
CSTR is a character string that will be displayed in the help box. The character ’|’
can be used as a newline character.
SWGSIZ
The routine SWGSIZ defines the size of widgets.
SWGPOS
The routine SWGPOS defines the position of widgets.
NX, NY are the upper left corner of the widget in pixels. The point is relative to the
upper left corner of the parent widget.
SWGWIN
The routine SWGWIN defines the position and size of widgets.
NX, NY are the upper left corner of the widget in pixels. The point is relative to the
upper left corner of the parent widget.
NW, NH are the width and height of the widget in pixels.
SWGTYP
The routine SWGTYP modifies the appearance of certain widgets.
223
CLASS is a character string containing the widget class where CLASS can have the
values ’LIST’, ’BOX’, ’SCALE’, ’PBAR’ ’TABLE’ and ’DRAW’. If CLASS
= ’LIST’, CTYPE can have the values ’AUTO’, ’SCROLL’ and ’NOSCROLL’.
If CLASS = ’BOX’ or CLASS = ’SCALE’, CTYPE can have the values
’VERT’ and ’HORI’. The class ’TABLE’ can have the options ’AUTO’,
’SCROLL’ and ’NOSCROLL’. For CLASS = ’DRAW’, CTYPE can have the
values ’SCROLL’ and ’NOSCROLL’. The size of a graphics in draw widgets
with scroll bars can be defined with the routine WINSIZ before SETXID.
Defaults: (’VERT’, ’BOX’), (’HORI’, ’SCALE’), (’AUTO’, ’TABLE’),
(’HORI’, ’PBAR’),(’AUTO’, ’LIST’), (’NOSCROLL’, ’DRAW’).
SWGJUS
The routine SWGJUS defines the alignment of labels in label and button widgets and of cell values in
table widgets.
SWGSPC
The routine SWGSPC defines horizontal and vertical space between widgets.
SWGSTP
The routine SWGSTP defines a step value for scale widgets.
The call is: CALL SWGSTP (XSTP)
or: void swgstp (float xstp);
XSTP is a positive floatingpoint number defining the step value. The default value is
(MAX - MIN) / 100.
SWGMRG
The routine SWGMRG defines margins for widgets.
224
The call is: CALL SWGMRG (IVAL, CMRG)
or: void swgmrg (int ival, char *cmrg);
IVAL is the margin value in pixels.
CMRG is a character string that can have the values ’LEFT’, ’TOP’, ’RIGHT’ and
’BOTTOM’. By default, all margins are zero.
SWGMIX
The routine SWGMIX defines control characters for separating elements in list strings.
SWGCBK
The routine SWGCBK connects a widget with a callback routine. The callback routine is called if the
status of the widget is changed. Callback routines can be defined for button, pushbutton, file, list, scale,
box, text and table widgets, and for popup menu entries. Since the syntax of callback routines for table
widgets is different, they must be defined with SWGCB2.
SWGCB2
The routine SWGCB2 defines callback routines for table widgets.
SWGATT
The routine SWGATT sets widget attributes.
225
or: void swgatt (int id, char *catt, char *copt);
ID is a widget ID.
CATT is a character string containing an attribute. If COPT = ’STATUS’, CATT
can have the values ’ACTIVE’, ’INACTIVE’ and ’INVISIBLE’. If COPT =
’LIST’, CATT can have new list elements for a list widget. In that case, CATT
has the same meaning as the parameter CLIS in WGLIS.
COPT is a character string that can have the values ’STATUS’ and ’LIST’.
SWGBUT
The routine SWGBUT sets the status of a button widget. If the widget is a push button widget, the
connected callback routine will be executed if the status 1 is passed to SWGBUT.
SWGLIS
The routine SWGLIS changes the selection in a list widget.
SWGBOX
The routine SWGBOX changes the selection in a box widget.
SWGTXT
The routine SWGTXT changes the value of a text widget and the label text in label widgets.
SWGINT
The routine SWGINT changes the value of a text widget.
226
ID is a widget ID of a text widget.
IVAL is an integer number which will be displayed in a text widget.
SWGFLT
The routine SWGFLT changes the value of a text widget.
SWGFIL
The routine SWGFIL changes the value of a file widget.
SWGSCL
The routine SWGSCL changes the value of a scale widget.
SWGVAL
The routine SWGVAL changes the value of a progress bar.
SWGTBF
The routine SWGTBF sets floatingpoint values in table cells.
The call is: CALL SWGTBF (ID, XVAL, NDIG, IROW, ICOL, COPT)
or: void swgtbf (int id, float xval, int ndig, int irow, int icol, char copt);
ID is a widget ID of a table widget.
XVAL is a floatingpoint number which will be displayed in a table widget.
227
NDIG is the number of digits displayed after the decimal point (≥ -2). NDIG = -2
means that the number of digits is calculated by DISLIN.
IROW, ICOL are the row and column indices of the table cell (≥ -1). The value -1 means that
a complete row or column is filled with XVAL and the index 0 corresponds to
header cells.
COPT is a character string that can have the value ’VALUE’.
SWGTBI
The routine SWGTBI sets integers in table cells, or defines fore- and background colours for table cells.
The call is: CALL SWGTBI (ID, IVAL, IROW, ICOL, COPT)
or: void swgtbi (int id, int ival, int irow, int icol, char copt);
ID is a widget ID of a table widget.
IVAL is an integer that contains the cell or a colour value. Colour values can be
calculated from RGB values with the function INTRGB.
IROW, ICOL are the row and column indices of the table cell (≥ -1). The value -1 means
that a complete row or column is used while the index 0 corresponds to header
cells.
COPT is a character string that defines the meaning of IVAL. COPT can have the
values ’VALUE’, ’BACK’, ’FORE’ and ’SYSTEM’. The options ’BACK’ and
’FORE’ are used for back- and foreground colours. The option ’SYSTEM’
resets the colours in table cells back to system values.
SWGTBL
The routine SWGTBL passes an array of floatingpoint values to a table widget.
The call is: CALL SWGTBL (ID, XRAY, N, NDIG, IDX, COPT)
or: void swgtbl (int id, float *xray, int n, int ndig, int idx, char copt);
ID is a widget ID of a table widget.
XRAY is an array of floatingpoint numbers.
N is the number of elements in XRAY.
NDIG is the number of digits displayed after the decimal point (≥ -2) for XRAY.
NDIG = -2 means that the number of digits is calculated by DISLIN.
IDX is the index of a table row or column (≥ 1). IDX may be ignored for some
options in COPT.
COPT is a character string that can have the values ’ROW’, ’COLUMN’, ’RTABLE’
and ’CTABLE’. The keyword ’ROW’ means that a table row is filled with
XRAY. ’COLUMN’ means that a column is used. For COPT = ’RTABLE’,
the complete table is filled with XRAY by rows and for COPT = ’CTABLE’,
the table is filled by columns.
SWGTBS
The routine SWGTBS sets character values and options for single table cells.
The call is: CALL SWGTBS (ID, CVAL, IROW, ICOL, COPT)
or: void swgtbs (int id, char *cval, int irow, int icol, char copt);
228
ID is a widget ID of a table widget.
CVAL is a character string that contains the new cell value or a character option. Up
to 80 characters are accepted by table cells.
IROW, ICOL are the row and column indices of the table cell (≥ -1). The value -1 means
that a complete row or column is used while the index 0 corresponds to header
cells.
COPT is a character string that defines the meaning of CVAL. COPT can have the
values ’VALUE’, ’EDIT’ and ’ALIGN’. The option ’EDIT’ enables or dis-
ables edit mode for table cells where the corresponding option in CVAL can
have the values ’ON’ and ’OFF’. The default behaviour is ’OFF’. ’ALIGN’ de-
fines the alignment in table cells where CVAL can have the keywords ’LEFT’,
’CENTER’ and ’RIGHT’. The default value is ’RIGHT’.
SWGRAY
The routine SWGRAY sets the width of table columns. It should be called before WGTBL.
GWGTXT
The routine GWGTXT returns the input of a text widget.
GWGINT
The routine GWGINT returns the input of a text widget as an integer value.
229
The call is: CALL GWGINT (ID, IVAL)
or: int gwgint (int id);
ID is the index of the text widget.
IVAL is the returned integer number.
GWGFLT
The routine GWGFLT returns the input of a text widget as a floatingpoint value.
GWGFIL
The routine GWGFIL returns the input of a file widget.
GWGLIS
The routine GWGLIS returns the selected element of a list widget.
GWGBOX
The routine GWGBOX returns the selected element of a box widget.
GWGSCL
The routine GWGSCL returns the value of a scale widget.
230
GWGTBF
The routine GWGTBF returns the value of a table cell as floatingpoint number.
GWGTBI
The routine GWGTBI returns the value of a table cell as integer number.
GWGTBL
The routine GWGTBL fills a floatingpoint user array with table values.
GWGTBS
The routine GWGTBS returns the value of a table cell as character string.
GWGATT
The routine GWGATT returns a widget attribute.
231
ID is a widget ID.
IATT is a returned attribute. If COPT = ’STATUS’, IATT can have the values 0 for
’ACTIVE’, 1 for ’INACTIVE’ and 2 for ’INVISIBLE’.
COPT is a character string that can have the value ’STATUS’.
GWGXID
The routine GWGXID returns the window ID for a specified widget ID.
ITMCNT
The routine ITMCNT returns the number of elements in a list string.
ITMCAT
The routine ITMCAT concatenates an element to a list string.
232
Additional note: Trailing blanks in CLIS and CITEM will be ignored.
MSGBOX
The routine MSGBOX displays a message in form of a dialog widget. It can be used to display messages
in callback routines.
REAWGT
The routine REAWGT realizes a widget tree. Since the windows ID of a widget can only be calculated
for X11 if the widget is already realized, this routine is useful if the windows ID of a widget is needed
before WGFIN. Normally, the widget tree is realized in WGFIN.
SENDOK
The routine SENDOK has the same meaning as when the OK entry in the Exit menu is pressed. All
widgets are deleted and the program is continued after WGFIN.
SENDMB
The routine SENDMB sends a mouse button 2 event to the DISLIN routine DISFIN. It can be used for
closing the graphics window.
DWGBUT
The routine DWGBUT displays a message that can be answered by the user with ’Yes’ or ’No’.
233
or: int dwgbut (char *cstr, int ival);
CSTR is a character string that will be displayed in a message box. Multiple lines can
be separated by the character ’|’.
IVAL is the returned answer of the user. IVAL = 1 means ’Yes’, IVAL = 0 means
’No’. IVAL is also used to initialize the button.
DWGTXT
The routine DWGTXT creates a dialog widget that can be used to prompt the user for input.
DWGFIL
The routine DWGFIL creates a file selection box that can be used to get a filename.
DWGLIS
The routine DWGLIS creates a dialog widget that can be used to to get a selection from a list of items.
234
15.6 Examples
The following short program creates some widgets and requests the values of the widgets.
PROGRAM EXA1
CHARACTER*80 CL1,CFIL
CL1=’Item1|Item2|Item3|Item4|Item5’
CFIL=’ ’
235
Figure 15.2: Widgets
236
The next example displays some widgets packed in two columns.
PROGRAM EXA2
CHARACTER*80 CL1,CSTR
CL1=’Item1|Item2|Item3|Item4|Item5’
CSTR=’ ’
237
The following example explains the use of callback routines. A list widget is created and the selected list
element is displayed in a text widget.
PROGRAM EXA3
COMMON /MYCOM1/ ID_LIS,ID_TXT
COMMON /MYCOM2/ CLIS
CHARACTER*80 CLIS
EXTERNAL MYSUB
238
The C coding of example 3 is given below:
#include <stdio.h>
#include "dislin.h"
main()
{ int ip;
ip = wgini ("VERT");
id_lis = wglis (ip, clis, 1);
swgcbk (id_lis, mysub);
PROGRAM EXA4
REAL XRAY(50),XWRAY(6)
CHARACTER*80 CSTR
DATA XWRAY/-10.,-18.,-18.,-18.,-18.,-18./
DO I=1,50
XRAY(I)=I
END DO
239
CALL SWGTBS (ID_TBL, ’Table’, 0, 0, ’VALUE’)
DO I=1,10
IF (I.EQ.10) THEN
WRITE(CSTR, ’(A,I2)’) ’R’,I
else
WRITE(CSTR,’(A,I1)’) ’R’,I
END IF
CALL SWGTBS (ID_TBL, CSTR, I, 0, ’VALUE’)
END DO
DO I=1,5
WRITE(CSTR, ’(A,I1)’) ’C’,I
CALL SWGTBS (ID_TBL, CSTR, 0, I, ’VALUE’)
END DO
240
Chapter 16
Quickplots
This chapter presents some quickplots that are collections of DISLIN routines for displaying data with
one statement. Axis scaling is done automatically by the quickplots. By default, graphical output is sent
to the screen.
QPLOT
QPLOT connects data points with lines.
241
16.4 Pie Charts
QPLPIE
QPLPIE plots a pie chart.
ZMAT is a matrix with the dimension (IXDIM, IYDIM) containing the function val-
ues.
IXDIM, IYDIM are the dimensions of ZMAT.
ZMAT is a matrix with the dimension (IXDIM, IYDIM) containing the function val-
ues.
IXDIM, IYDIM are the dimensions of ZMAT.
The call is: CALL QPLCON (ZMAT, IXDIM, IYDIM, NLV) level 0, 1
or: void qplcon (float *zmat, int ixdim, int iydim, int nlv);
ZMAT is a matrix with the dimension (IXDIM, IYDIM) containing the function val-
ues.
IXDIM, IYDIM are the dimensions of ZMAT.
NLV is the number of contour levels that should be generated.
242
16.8 Setting Parameters for Quickplots
Quickplots can be called in level 0 and in level 1 of DISLIN. If they are called in level 0, the statements
CALL METAFL (’CONS’) and CALL DISINI are executed by quickplots. If they are called in level 1,
these statements will be suppressed. This means that programs can change the output device of quickplots
and define axis names and titles if they call quickplots in level 1 after a call to DISINI.
The following example defines axis names and a title for QPLOT:
243
244
Appendix A
The most DISLIN distributions contain plotting extensions for the interpreting languages Perl, Python
and Java. This appendix gives a short description of how DISLIN can be called from this languages. For
a complete description, the user is referred to the Perl, Python, Java and DISGCL manuals of DISLIN.
filename is the name of a DISGCL script file. The extension ’.gcl’ is optional.
args are optional arguments that can be passed to DISGCL scripts (see DISGCL).
options is an optional field of keywords separated by blanks (see DISGCL).
245
- A DISGCL script file must begin with the indentifier ’%GCL’.
- Each line may contain up to 132 characters.
- The current statement can be continued on the next line if a masterspace (@) is used at the end of
the line.
- Lines are allowed to carry trailing comment fields, following a double slash (//) or the ’#’ character.
Empty lines are also be interpreted as comment lines.
- Keywords and routine names can be in upper and lowercase letters.
- String constants must be enclosed in a pair of either apostrophes or quotation marks.
%GCL
// Demonstration of CURVE
N=101
PI = 3.1415926
METAFL (’CONS’)
DISINI ()
COMPLX ()
PAGERA ()
GRAF (0.,360.,0.,90.,-1.,1.,-1.,0.5)
TITLE ()
COLOR (’RED’)
CURVE (xray, yray1, n)
COLOR (’GREEN’)
CURVE (xray, yray2, n)
COLOR (’FORE’)
DASH ()
XAXGIT ()
DISFIN ()
246
A.2 Using DISLIN from Perl
The Practical Extraction and Report Language is supported by DISLIN. Pre-compiled DISLIN modules
for Perl are available for the most operating systems.
For passing parameters from Perl to DISLIN, the following rules are applied:
- Parameters can be passed from Perl to DISLIN routines as variables, constants and expressions.
- String constants must be enclosed in a pair of either apostrophes or quotation marks.
- Floatingpoint parameters can be passed from Perl as integer and floatingpoint numbers.
- Arrays can be passed from Perl to DISLIN with the starting characters ’\ @’.
Note: Normally, the number and meaning of parameters passed to DISLIN routines are identical with
the syntax description of the routines in the DISLIN manual. DISLIN routines that return one
scalar are implemented for Perl as functions. A description of all DISLIN routines that can be
called from Perl is presented in the DISLIN manual for Perl.
#!/usr/bin/perl
use Dislin;
$n = 101;
$pi = 3.1415926;
$f = $pi / 180.;
$step = 360. / ($n - 1);
for ($i = 0; $i < $n; $i++) {
$xray[$i] = $i * $step;
$x = $xray[$i] * $f;
$y1ray[$i] = sin ($x);
$y2ray[$i] = cos ($x);
}
Dislin::metafl (’xwin’);
Dislin::disini ();
Dislin::complx ();
Dislin::pagera ();
247
Dislin::color (’red’);
Dislin::curve (\@xray, \@y1ray, $n);
Dislin::color (’green’);
Dislin::curve (\@xray, \@y2ray, $n);
Dislin::color (’foreground’);
Dislin::dash ();
Dislin::xaxgit ();
Dislin::disfin ();
- Parameters can be passed from Python to DISLIN routines as variables, constants and expres-
sions.
- String constants must be enclosed in a pair of either apostrophes or quotation marks.
- Floatingpoint parameters can be passed from Python as integer and floatingpoint numbers.
- Integer parameters can be passed from Python as integer and floatingpoint numbers. If a float-
ingpoint number is passed for an integer parameter, the fractional part of the floatingpoint
number will be truncated.
- Floatingpoint arrays can be passed from Python as floatingpoint and integer lists. They were
copied to 32 bit C arrays before they are passed to DISLIN routines.
- Integer arrays must be passed as integer lists.
- Memory must be allocated for Arrays that are used from DISLIN routines as output parameters.
For example, they can be created with the Python command ’range’.
Note: Normally, the number and meaning of parameters passed to DISLIN routines are identical with
the syntax description of the routines in the DISLIN manual. DISLIN routines that return one
ore more scalars are implemented for Python as functions that return a tuple of scalars. For
example, the statement ’nw,nh = getpag ()’ returns the page size.
#! /usr/bin/env python
import math
import dislin
n = 101
f = 3.1415926 / 180.
x = range (n)
y1 = range (n)
y2 = range (n)
for i in range (0,n):
x[i] = i * 3.6
v = i * 3.6 * f
y1[i] = math.sin (v)
y2[i] = math.cos (v)
248
dislin.metafl (’xwin’)
dislin.disini ()
dislin.complx ()
dislin.pagera ()
dislin.color (’red’)
dislin.curve (x, y1, n)
dislin.color (’green’)
dislin.curve (x, y2, n)
dislin.color (’foreground’)
dislin.dash ()
dislin.xaxgit ()
dislin.disfin ()
- Parameters can be passed from Java to DISLIN routines as variables, constants and expressions.
- String constants must be enclosed in a pair quotation marks.
- Floatingpoint parameters must be passed as float variables, constants and expressions. Float-
ingpoint constants are specified with an appending f or F.
- Integer parameters must be of type int.
- Two-dimensional arrays must be passed as one-dimensional arrays from Java to DISLIN.
For example, if you have the two-dimensional array XMAT[N][M] in Java, you have to
pass the one-dimensional array XRAY[N*M] to DISLIN where XRAY[i*M+j] corresponds
to XMAT[i][j].
- The number and meaning of parameters passed to DISLIN routines are identical with the syntax
description of the routines in the DISLIN manual except for routines that change parameters.
These routines are implemented in Java as functions with a return value. For example, the func-
tion getpag (&nw, &nh) returns in DISLIN the page width. In Java, this routine is implemented
as nw = getpag (1) and nh = getpag (2).
249
Example C.1 of appendix C coded in Java has the following form:
import de.dislin.Dislin;
public class curve {
public static void main (String args []) {
int n = 100, i;
double x, fpi = 3.1415926/180., step = 360. / (n-1);
Dislin.metafl ("cons");
Dislin.disini ();
Dislin.pagera ();
Dislin.complx ();
Dislin.color ("red");
Dislin.curve (xray, y1ray, n);
Dislin.color ("green");
Dislin.curve (xray, y2ray, n);
Dislin.color ("fore");
Dislin.dash ();
Dislin.xaxgit ();
Dislin.disfin ();
}
}
250
Appendix B
251
TIFMOD defines the physical resolution of TIFF files.
UNITS defines the plot units.
WMFMOD modifies the format of WMF files.
Colours
COLOR defines the colour used for text and lines.
HSVRGB converts HSV to RGB coordinates.
INDRGB calculates an colour index.
INTRGB calculates an explicit colour value.
MYVLT changes the current colour table.
RGBHSV converts RGB to HSV coordinates.
SETCLR defines colours.
SETIND changes the current colour table.
SETRGB defines colours.
SETVLT selects a colour table.
VLTFIL stores or loads a colour table.
252
Fonts
BASALF defines the base alphabet.
BMPFNT defines a bitmap font.
CHACOD defines the character coding.
COMPLX sets a complex font.
DUPLX sets a double-stroke font.
DISALF sets the default font.
EUSHFT defines a shift character for special European characters.
GOTHIC sets a gothic font.
HELVE sets a shaded font.
HELVES sets a shaded font with small characters.
HWFONT sets a standard hardware font.
PSFONT sets a PostScript font.
PSMODE enables Greek and Italic PostScript characters.
SERIF sets a complex shaded font.
SIMPLX sets a single-stroke font.
SMXALF defines shift characters for alternate alphabets.
TRIPLX sets a triple-stroke font.
WINFNT sets a TrueType font for screen output on Windows.
X11FNT sets an X11 font for screen output on X11 systems.
Symbols
HSYMBL defines the height of symbols.
MYSYMB defines an user-defined symbol.
RLSYMB plots symbols where the centre is specified in user coordinates.
SYMBOL plots symbols.
SYMROT defines a rotation angle for symbols.
Axis Systems
ADDLAB plots additional single labels.
AX2GRF suppresses the plotting of the upper X- and the left Y-axis.
AX3LEN defines axis lengths for a coloured 3-D axis system.
AXGIT plots the lines X = 0 and Y = 0.
AXSBGD defines the background colour.
AXSLEN defines axis lengths for a 2-D axis system.
AXSORG determines the position of crossed axis systems.
AXSPOS determines the position of axis systems.
AXSTYP selects rectangular or crossed axis systems.
BOX2D plots a border around an axis system.
CENTER centres axis systems.
CROSS plots the lines X = 0 and Y = 0 and marks them with ticks.
ENDGRF terminates an axis system.
FRMCLR defines the colour of frames.
FRAME defines the frame thickness of axis systems.
GAXPAR calculates axis parameters.
GRACE affects the clipping margin of axis systems.
GRAF plots a two-dimensional axis system.
GRAF3 plots an axis system for colour graphics.
GRAFP plots a polar axis system.
GRDPOL plos a ploar grid.
GRID overlays a grid on an axis system.
253
NOCLIP suppresses clipping of user coordinates.
NOGRAF suppresses the plotting of an axis system.
POLMOD modifies the appearance of polar labels.
SETGRF suppresses parts of an axis system.
SETSCL sets automatic scaling.
TITLE plots a title over an axis system.
XAXGIT plots the line Y = 0.
XCROSS plots the line Y = 0 and marks it with ticks.
YAXGIT plots the line X = 0.
YCROSS plots the line X = 0 and marks it with ticks.
Secondary Axes
XAXIS plots a linear X-axis.
XAXLG plots a logarithmic X-axis.
YAXIS plots a linear Y-axis.
YAXLG plots a logarithmic Y-axis.
ZAXIS plots a linearly scaled colour bar.
ZAXLG plots a logarithmically scaled colour bar.
Modification of Axes
AXCLRS defines colours for axis elements.
AXENDS suppresses certain labels.
AXSSCL defines the axis scaling.
HNAME defines the character height of axis names.
INTAX defines integer numbering for all axes.
LABDIG sets the number of decimal places for labels.
LABDIS sets the distance between labels and ticks.
LABELS selects labels.
LABJUS defines the alignment of axis labels.
LABMOD modifies date labels.
LABPOS determines the position of labels.
LABTYP defines vertical or horizontal labels.
LOGTIC modifies the appearance of logarithmic ticks.
MYLAB sets user-defined labels.
NAMDIS sets the distance between axis names and labels.
NAME defines axis titles.
NAMJUS defines the alignment of axis titles.
NOLINE suppresses the plotting of axis lines.
RGTLAB right-justifies labels.
RVYNAM defines an angle for Y-axis names.
TICKS sets the number of ticks.
TICLEN sets the length of ticks.
TICMOD modifies the plotting of ticks at calendar axes.
TICPOS determines the position of ticks.
TIMOPT modifies time labels.
Axis System Titles
HTITLE defines the character height of titles.
LFTTIT left-justifies title lines.
LINESP defines line spacing.
TITJUS defines the alignment of titles.
TITLE plots axis system titles.
TITLIN defines text lines for titles.
TITPOS defines the position of titles.
VKYTIT shifts titles in the vertical direction.
254
Plotting Data Points
BARS plots a bar graph.
BARS3D plots 3-D bars.
CHNATT changes curve attributes.
CHNCRV defines attributes changed automatically by CURVE.
CRVMAT plots a coloured surface.
CRVTRI plots a coloured surface from triangulated data.
CURVE plots curves.
CURVE3 plots coloured rectangles.
CURVX3 plots rows of coloured rectangles.
CURVY3 plots columns of coloured rectangles.
ERRBAR plots error bars.
FIELD plots a vector field.
GAPCRV defines gaps plotted by CURVE.
INCCRV defines the number of curves plotted with equal attributes.
INCMRK selects symbols or lines for CURVE.
MARKER sets the symbols plotted by CURVE.
NOCHEK suppresses listing of data points that lie outside of the axis scaling.
PIEGRF plots a pie chart.
POLCRV defines the interpolation method used by CURVE.
RESATT resets curve attributes.
SETRES sets the size of coloured rectangles.
SHDCRV plots shaded areas between curves.
SPLMOD modifies spline interpolation.
THKCRV defines the thickness of curves.
VECFLD plots a vector field.
Legends
FRAME sets the frame thickness of legends.
LEGEND plots legends.
LEGINI initializes legends.
LEGLIN defines text for legend lines.
LEGOPT modifies the appearance of legends.
LEGPAT stores curve attributes.
LEGPOS determines the position of legends.
LEGTIT defines the legend title.
LEGVAL modifies the appearance of legends.
LINESP affects line spacing.
MIXLEG enables multiple text lines in legends.
NXLEGN returns the width of legends in plot coordinates.
NYLEGN returns the height of legends in plot coordinates.
255
LINTYP defines a line style.
LINWID sets the line width.
LNCAP sets the line cap parameter.
LNJOIN sets the line join parameter.
LNMLT sets the miter limit parameter.
MYLINE sets a user-defined line style.
MYPAT defines a global shading pattern.
PENWID sets the pen width.
SHDPAT selects a shading pattern.
SOLID sets a solid line style.
Cycles
CLRCYC modifies the colour cycle.
LINCYC modifies the line style cycle.
PATCYC modifies the pattern cycle.
Base Transformations
TR3RES resets 3-D base transformations.
TR3ROT affects the 3-D rotation of plot vectors.
TR3SCL affects the 3-D scaling of plot vectors.
TR3SHF affects the 3-D shifting of plot vectors.
TRFRES resets base transformations.
TRFROT affects the rotation of plot vectors.
TRFSCL affects the scaling of plot vectors.
TRFSHF affects the shifting of plot vectors.
Shielding
SHIELD defines automatic shielding.
SHLCIR defines circles as shielded areas.
SHLDEL deletes shielded areas.
SHLELL defines ellipses as shielded areas.
SHLIND returns the index of a shielded area.
SHLPIE defines pie segments as shielded areas.
SHLPOL defines polygons as shielded areas.
SHLRCT defines rotated rectangles as shielded areas.
SHLREC defines rectangles as shielded areas.
SHLRES deletes shielded areas.
SHLVIS enables or disables shielded areas.
256
GETLAB returns the current labels.
GETLEN returns the current axis lengths.
GETLEV returns the current level.
GETLIN returns the current line width.
GETMFL returns the current file format.
GETMIX returns shift characters defined for indices and exponents.
GETOR returns the current origin.
GETPAG returns the current page size.
GETPAT returns the current shading pattern.
GETPLV returns the patchlevel of the current DISLIN library.
GETPOS returns the position of the axis system.
GETRAN returns the range of colour bars.
GETRES returns the size of points used in 3-D colour graphics.
GETRGB returns the RGB coordinates of the current colour.
GETSCL returns the current axis scaling.
GETSCR returns the screen size in pixels.
GETSHF returns the control character used for European characters.
GETSP1 returns the distance between axis ticks and labels.
GETSP2 returns the distance between axis labels and names.
GETSYM returns the current symbol number and height.
GETTCL returns the current tick lengths.
GETTIC returns the number of ticks plotted between labels.
GETTYP returns the current line style.
GETUNI returns the current unit used for messages.
GETVER returns the version number of the currently used DISLIN library.
GETVK returns the current lengths used for shifting.
GETVLT returns the current colour table.
GETWID returns the width of colour bars.
GETWIN returns the position and size of the graphics window.
GETXID returns the X window ID.
GMXALF returns shift characters for alphabets.
257
RLPOIN plots coloured rectangles for user coordinates.
RLREC plots rectangles for user coordinates.
RLRND plots for user coordinates a rectangle with rounded corners.
RLSEC plots coloured pie sectors for user coordinates.
RLSTRT moves the pen to a point (user coordinates).
RLVEC plots vectors for user coordinates.
RLWIND plots wind speed symbols for user coordinates.
SECTOR plots coloured pie sectors.
STRTPT moves the pen to a point.
TRIFLL plots filled triangles.
VECCLR defines coulour for arrow heads.
VECOPT defines vector options.
VECTOR plots vectors.
WINDBR plots wind speed symbols.
XMOVE moves the pen to a point.
XDRAW plots a line to a point.
Conversion of Coordinates
COLRAY converts Z-coordinates to colour numbers.
NXPIXL converts X plot coordinates to pixel
NXPOSN converts X-coordinates to plot coordinates.
NYPIXL converts Y plot coordinates to pixel
NYPOSN converts Y-coordinates to plot coordinates.
NZPOSN converts Z-coordinates to colour numbers.
TRFCO1 converts one-dimensional coordinates.
TRFCO2 converts two-dimensional coordinates.
TRFCO3 converts three-dimensional coordinates.
TRFREL converts X- and Y-coordinates to plot coordinates.
XINVRS converts X plot coordinates to user coordinates.
XPOSN converts X-coordinates to real plot coordinates.
YINVRS converts Y plot coordinates to user coordinates.
YPOSN converts Y-coordinates to real plot coordinates.
Utility Routines
BEZIER calculates a Bezier interpolation.
BITSI2 allows bit manipulation on 16 bit variables.
BITSI4 allows bit manipulation on 32 bit variables.
CIRC3P calculates a circle specified by three points.
FCHA converts floating-point numbers to character strings.
FLEN calculates the number of digits for floating-point numbers.
HISTOG calculates a histogram.
INTCHA converts integers to character strings.
INTLEN calculates the number of digits for integers.
INTUTF converts Unicode numbers to an UTF8 string.
NLMESS returns the length of character strings in plot coordinates.
NLNUMB returns the length of numbers in plot coordinates.
POLCLP clips a polygon.
SORTR1 sorts floating-point numbers.
SORTR2 sorts points in the X-direction.
SPLINE returns splined points as calculated in CURVE.
SWAPI2 swaps the bytes of 16 bit variables.
258
SWAPI4 swaps the bytes of 32 bit variables.
TRFMAT converts matrices.
TRIANG calculates the Delaunay triangulation.
TRMLEN calculates the number of characters in character strings.
UPSTR converts a character string to uppercase letters.
UTFINT converts an UTF8 string to Unicode numbers.
Date Routines
BASDAT defines the base date.
INCDAT calculates incremented days.
NWKDAY returns the weekday for a date.
TRFDAT converts incremented days to a date.
Window Routines
CLSWIN closes a window.
OPNWIN opens a window for graphics output.
PAGWIN defines page formats for windows.
SELWIN selects a window for graphics output.
WINAPP defines a window or console application.
WINDOW defines the position and size of windows.
WINID returns the ID of the currently selected window.
WINKEY defines a key that can be used for program continuation in DISFIN.
WINMOD affects the handling of windows in the termination routine DISFIN.
WINSIZ defines the size of windows.
WINTIT sets the title of the currently selected window.
Cursor Routines
CSRKEY returns a key event.
CSRMOD modifies the behavior of CSRPOS.
CSRMOV returns collected cursor movements.
CSRPOS sets and returns the cursor position.
CSRPT1 returns a pressed cursor position.
CSRPTS returns collected cursor positions.
CSRREC returns a rectangle created with the mouse cursor.
CSRTYP defines the cursor type.
CSRUNI defines the unit returned cursor routines.
SETCSR defines the cursor type of the graphics window.
259
Image Routines
IMGBOX defines a rectangle for PostScript/PDF output.
IMGCLP defines a clipping rectangle for RBMP, RTIFF, RPNG, RGIF, and RPPM.
IMGINI initializes transfering of image data.
IMGFIN terminates transfering of image data.
IMGMOD selects index or RGB mode.
IMGSIZ defines an image size for PostScript/PDF output.
RBFPNG stores an image as PNG file in a buffer.
RBMP stores an image as a BMP file.
RGIF stores an image as a GIF file.
RIMAGE copies an image from memory to a file.
RPIXEL reads a pixel from memory.
RPIXLS reads image data from memory.
RPNG stores an image as a PNG file.
RPPM stores an image as a PPM file.
RPXROW reads a row of image data from memory.
RTIFF stores an image as a TIFF file.
TIFORG defines the position of TIFF files copied with WTIFF.
TIFWIN defines a clipping window for TIFF files copied with WTIFF.
WIMAGE copies an image from file to memory.
WPIXEL writes a pixel to memory.
WPIXLS writes image data to memory.
WPXROW write a row of image data to memory.
WTIFF copies a TIFF file created by DISLIN to memory.
Transparency
TPRFIN terminates alpha blending.
TPRINI initializes alpha blending.
TPRMOD modifies alpha blending.
TPRVAL sets the alpha value.
Bar Graphs
BARBOR defines the colour of bar borders.
BARCLR defines the colours of bars.
BARGRP affects clustered bars.
BARMOD selects fixed or variable bars.
BAROPT sets parameters for 3-D bars.
BARPOS selects predefined positions for bars.
BARS plots bar graphs.
BARTYP selects vertical or horizontal bars.
CHNBAR modifies the appearance of bars.
LABCLR defines the colour of bar labels.
LABDIG defines the number of decimal places in bar labels.
LABELS defines bar labels.
LABPOS defines the position of bar labels.
260
Pie Charts
CHNPIE defines colour and pattern attributes for pie segments.
LABCLR defines the colour of segment labels.
LABDIG defines the number of decimal places in segment labels.
LABELS defines pie labels.
LABPOS defines the position of segment labels.
LABTYP modifies the appearance of segment labels.
PIEBOR defines the colour of pie borders.
PIECLR defines pie colours.
PIEEXP defines exploded pie segments.
PIEGRF plots pie charts.
PIELAB sets additional character strings plotted in segment labels.
PIEOPT sets parameters for 3-D pie charts.
PIETYP selects 2-D or 3-D pie charts.
PIEVEC modifies the arrow plotted between labels and segments.
USRPIE is a user-defined subroutine to modify pie charts.
261
3-D Graphics
ABS3PT converts absolute 3-D coordinates to plot coordinates.
AXIS3D defines the lengths of the 3-D box.
BARS3D plots 3-D bars.
BOX3D plots a border around the 3-D box.
CONE3D plots a cone.
CONN3D plots a line to a point in 3-D space.
CURV3D plots curves or symbols.
CYLI3D plots a cylinder.
DBFFIN termintes a depth sort.
DBFINI initializes a depth sort.
DISK3D plots a disk.
FIELD3D plots a vector field.
FLAB3D disables the suppression of axis labels.
GETLIT calculates colour values.
GETMAT calculates a function matrix from randomly distributed data points.
GRAF3D plots an axis system.
GRFFIN terminates a projection into 3-D space.
GRFINI initializes projections in 3-D space.
GRID3D plots a grid.
HSYM3D sets the height of 3-D symbols.
ISOPTS calculates isosurfaces.
LABL3D modifies the appearance of labels on the 3-D box.
LIGHT turns lighting on or off.
LITMOD turns single light sources on or off.
LITOP3 modifies light parameters.
LITOPT modifies light parameters.
LITPOS sets the position of light sources.
MATOP3 modifies material parameters.
MATOPT modifies material parameters.
MDFMAT modifies the algorithm used in GETMAT.
MSHCLR defines the colour of surface meshes.
NOHIDE disables the hidden-line algorithm.
PIKE3D plots a cone.
PLAT3D plots a Platonic solid.
POS3PT converts user coordinates to absolute 3-D coordinates.
PYRA3D plots a pyramid.
QUAD3D plots a quad.
REL3PT converts user coordinates to plot coordinates.
ROT3D defines rotation angles for symbols and solids.
SETFCE sets a face side for defining material parameters.
SHDMOD defines flat or smooth shading for surfaces.
SHLSUR protects surfaces from overwriting.
SPHE3D plots a sphere.
STRT3D moves the pen to a point.
SURCLR selects surface colours.
SURFCE plots the surface of a function matrix.
SURFCP plots a shaded surface of a parametric function.
SURFUN plots the surface of the function Z = F(X,Y).
SURISO plots isosurfaces.
SURMAT plots the surface of a function matrix.
262
SURMSH enables grid lines.
SUROPT suppresses surfaces lines plotted by SURFCE.
SURSHD plots a coloured surface.
SURTRI plots a coloured surface from triangulated data.
SURVIS determines the visible part of surfaces.
SYMB3D plots a 3-D symbol.
TORUS3D plots a torus.
TUBE3D plots a tube.
VANG3D defines the field of view.
VECF3D plots a vector field.
VECTR3 plots vectors in 3-D space.
VFOC3D defines the focus point.
VIEW3D defines the viewpoint.
VTX3D plots faces from vertices.
VTXC3D plots faces from vertices.
VTXN3D plots faces from vertices.
VUP3D defines the camera orientation.
ZBFERS erases the frame buffer of a Z-buffer.
ZBFFIN terminates the Z-buffer.
ZBFINI allocates space for a Z-buffer.
ZBFLIN plots lines.
ZBFRES resets the Z-buffer.
ZBFSCL scales the internal image for PDF output.
ZBFTRI plots triangles.
ZSCALE defines a Z-scaling for coloured surfaces.
Geographical Projections
CURVMP plots curves or symbols.
GRAFMP plots a geographical axis system.
GRIDMP plots a grid.
MAPBAS defines a base map.
MAPFIL defines an external map file.
MAPLAB enables labels for elliptical and azimuthal projections.
MAPLEV specifies land or lake plotting.
MAPMOD modifies the connection of points used in CURVMP.
MAPOPT sets options for map plotting.
MAPPOL defines the map pole used for azimuthal projections.
MAPREF defines two latitudes used for conical projections.
POS2PT converts user coordinates to plot coordinates.
PROJCT selects a projection.
SETCBK sets a callback routine for a user-defined projection.
SHDAFR shades African countries.
SHDASI shades Asiatic countries.
SHDAUS shades Oceanic countries.
SHDEUR shades European countries.
SHDMAP shades continents.
SHDNOR shades states of North and Central America.
SHDSOU shades states of South America.
SHDUSA shades USA states.
WORLD plots coastlines and lakes.
XAXMAP plots a secondary X-axis.
YAXMAP plots a secondary Y-axis.
263
Contouring
CONCLR defines colours fro filled contours.
CONCRV plots generated contours.
CONFLL plots filled contours from triangulated data.
CONGAP affects the spacing between contour lines and labels.
CONLAB defines a character string used for contour labels.
CONMAT plots contours.
CONMOD affects the position of contour labels.
CONPTS generates contours.
CONSHD plots shaded contours.
CONTRI plots contours from triangulated data.
CONTUR plots contours.
LABCLR defines the colour of contour labels.
LABDIS defines the distance between labels.
LABELS defines contour labels.
SHDMOD sets the algorithm for shaded contours.
TRIPTS generates contours from triangulated data.
Widget Routines
DWGBUT displays a message that can be answered with ’Yes’ or ’No’.
DWGFIL creates a file selection box.
DWGLIS gets a selection from a list of items.
DWGMSG displays a message.
DWGTXT prompts an user for input.
GWGATT requests a widget attribute.
GWGBOX requests the value of a box widget.
GWGBUT requests the status of a button widget.
GWGFIL requests the value of a file widget.
GWGFLT requests the value of a text widget as real number.
GWGINT requests the value of a text widget as integer.
GWGLIS requests the value of a list widget.
GWGSCL requests the value of a scale widget.
GWGTBF requests cell values of table widgets.
GWGTBI requests cell values of table widgets.
GWGTBL requests cell values of table widgets.
GWGTBS requests cell values of table widgets.
GWGTXT requests the value of a text widget.
GWGXID returns the window ID for a widget.
ITMCAT concatenates an element to a list string.
ITMCNT calculates the number of elements in a list string.
ITMSTR extracts an element from a list string.
MSGBOX prints a message.
SWGATT sets widget attributes.
SWGBOX changes the selection of a box widget.
SWGBUT changes the status of a button widget.
SWGCB2 connects a table widget with a callback routine.
SWGCBK connects a widget with a callback routine.
SWGCLR defines colours for widgets.
SWGDRW defines the height of draw widgets.
SWGFIL changes the value of a file widget.
SWGFLT changes the value of text widgets.
264
SWGFNT sets fonts for widgets.
SWGFOC sets the keyboard focus.
SWGHLP sets a character string that will be displayed if the Help menu is clicked.
SWGINT changes the value of text widgets.
SWGJUS defines the alignment of label widgets.
SWGLIS changes the selection of a list widget.
SWGMIX defines control characters.
SWGMRG defines widget margins.
SWGOPT sets a center option for the parent widget.
SWGPOP modifies the appearance of the popup menubar.
SWGPOS defines the position of widgets.
SWGRAY defines the width of columns in table widgets.
SWGSCL changes the value of a scale widget.
SWGSIZ defines the size of widgets.
SWGSPC modifies the space between widgets.
SWGSTP defines a step value for scale widgets.
SWGTBF sets cell values of table widgets.
SWGTBI sets cell values of table widgets.
SWGTBL sets cell values of table widgets.
SWGTBS sets cell values of table widgets.
SWGTIT sets a title for the main widget.
SWGTXT changes the value of a text widget.
SWGTYP modifies the appearance of widgets.
SWGVAL changes the value of progress bars.
SWGWIN defines the position and size of widgets.
SWGWTH sets the default width of widgets.
WGAPP creates an entry in a popup menu.
WGBAS creates a container wdiget.
WGBOX creates a list widget where the list elements are displayed as toggle buttons.
WGBUT creates a button widget.
WGCMD creates a command widget.
WGDLIS creates a dropping list widget.
WGDRAW creates a draw widget.
WGFIL creates a file widget.
WGFIN terminates widget routines.
WGINI creates a main widget and initalizes widget routines.
WGLAB creates a label widget.
WGLIS creates a list widget.
WGLTXT creates a labeled text widget.
WGOK creates a OK push button widget.
WGPBAR creates a progress bar.
WGPBUT creates a push button widget.
WGPOP creates a popup menu.
WGQUIT creates a QUIT push button widget.
WGSCL creates a scale widget.
WGSTXT creates a scrolled text widget.
WGTBL creates a table widget.
WGTXT creates a text widget.
265
Quickplots
QPLBAR plots a bar graph.
QPLCLR plots a colour surface of a matrix.
QPLCON plots a contour lines of a matrix.
QPLPIE plots a pie chart.
QPLOT makes a curve plot.
QPLSCA makes a scatter plot.
QPLSUR plots a surface of a matrix.
MPS Logo
MPSLOGO plots the MPS logo.
266
Appendix C
Examples
267
C.1 Demonstration of CURVE
PROGRAM EXA_1
C USE DISLIN for Fortran 90!
PARAMETER (N=301)
DIMENSION XRAY(N),Y1RAY(N),Y2RAY(N)
PI=3.1415926
FPI=PI/180.
STEP=360./(N-1)
DO I=1,N
XRAY(I)=(I-1)*STEP
X=XRAY(I)*FPI
Y1RAY(I)=SIN(X)
Y2RAY(I)=COS(X)
END DO
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL AXSPOS(450,1800)
CALL AXSLEN(2200,1200)
CALL NAME(’X-axis’,’X’)
CALL NAME(’Y-axis’,’Y’)
CALL LABDIG(-1,’X’)
CALL TICKS(9,’XY’)
CALL GRAF(0.,360.,0.,90.,-1.,1.,-1.,0.5)
CALL TITLE
CALL CURVE(XRAY,Y1RAY,N)
CALL CURVE(XRAY,Y2RAY,N)
CALL DASH
CALL XAXGIT
CALL DISFIN
END
268
Demonstration of CURVE
SIN(X), COS(X)
1.0
0.5
269
0.0
Y-axis
-1.0
0 90 180 270 360
X-axis
C.2 Polar Plots
PROGRAM EXA_2
C USE DISLIN for Fortran 90!
PARAMETER (N=300, M=10)
REAL XRAY1(N),YRAY1(N),XRAY2(M),YRAY2(M)
XPI=3.1415927
STEP=360./(N-1)
DO I=1,N
A=(I-1)*STEP
A=A*XPI/180
YRAY1(I)=A
XRAY1(I)=SIN(5*A)
END DO
DO I=1,M
XRAY2(I)=I
YRAY2(I)=I
END DO
CALL SETPAG(’DA4P’)
CALL METAFL(’CONS’)
CALL DISINI
CALL PAGERA
CALL HWFONT
CALL LABDIG(-1,’X’)
CALL AXSORG(1050,2250)
CALL LABTYP(’VERT’,’Y’)
CALL POLAR(10.,0.,2.,0.,30.)
CALL BARWTH(-5.)
CALL POLCRV(’FBARS’)
CALL CURVE(XRAY2,YRAY2,M)
CALL DISFIN
END
270
Polar Plots
90
12
60
0
15
0 30
180 0
0.2 0.4 0.6 0.8
0 33
21 0
0
30
24
0
270
90
20 60
1
0
30
15
180
2 4 6 8
10
33
2
0 30
24 0
270
271
C.3 Symbols
PROGRAM EXA_3
C USE DISLIN for Fortran 90!
CHARACTER*20 CTIT,CSTR*2
CTIT=’Symbols’
CALL SETPAG(’DA4P’)
CALL DISINI
CALL COMPLX
CALL PAGERA
CALL PAGHDR(’H. Michels (’,’)’,2,0)
CALL HEIGHT(60)
NL=NLMESS(CTIT)
CALL MESSAG(CTIT,(2100-NL)/2,200)
CALL HEIGHT(50)
CALL HSYMBL(120)
NY=150
DO I=0,21
IF(MOD(I,4).EQ.0) THEN
NY=NY+400
NXP=550
ELSE
NXP=NXP+350
END IF
IF(I.LT.10) THEN
WRITE(CSTR,’(I1)’) I
ELSE
WRITE(CSTR,’(I2)’) I
END IF
NL=NLMESS(CSTR)/2
CALL MESSAG(CSTR,NXP-NL,NY+150)
CALL SYMBOL(I,NXP,NY)
END DO
CALL DISFIN
END
272
Symbols
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
16 17 18 19
20 21 22 23
273
C.4 Logarithmic Scaling
PROGRAM EXA_4
C USE DISLIN for Fortran 90!
CHARACTER*60 CTIT,CLAB(3)*5
DATA CLAB/’LOG’,’FLOAT’,’ELOG ’/
CTIT=’Logarithmic Scaling’
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL AXSLEN(1400,500)
CALL NAME(’X-axis’,’X’)
CALL NAME(’Y-axis’,’Y’)
CALL AXSSCL(’LOG’,’XY’)
CALL TITLIN(CTIT,2)
DO I=1,3
NYA=2650-(I-1)*800
CALL LABDIG(-1,’XY’)
IF(I.EQ.2)THEN
CALL LABDIG(1,’Y’)
CALL NAME(’ ’,’X’)
END IF
CALL AXSPOS(500,NYA)
CALL MESSAG(’Labels: ’//CLAB(I),600,NYA-400)
CALL LABELS(CLAB(I),’XY’)
CALL GRAF(0.,3.,0.,1.,-1.,2.,-1.,1.)
IF(I.EQ.3) THEN
CALL HEIGHT(50)
CALL TITLE
END IF
CALL ENDGRF
END DO
CALL DISFIN
END
274
Figure B.4: Logarithmic Scaling
275
C.5 Interpolation Methods
PROGRAM EXA_5
C USE DISLIN for Fortran 90!
DIMENSION X(16), Y(16)
CHARACTER*8 CPOL(6),CTIT*60
DATA X/0.,1.,3.,4.5,6.,8.,9.,11.,12.,12.5,13.,
* 15.,16.,17.,19.,20./,
* Y/2.,4.,4.5,3.,1.,7.,2.,3.,5.,2.,2.5,2.,4.,6.,
* 5.5,4./,
* CPOL/’SPLINE’,’STEM’,’BARS’,’STAIRS’,’STEP,’LINEAR’/
* NYA/2700/
CTIT=’Interpolation Methods’
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL INCMRK(1)
CALL HSYMBL(25)
CALL TITLIN(CTIT,1)
CALL AXSLEN(1500,350)
CALL SETGRF(’LINE’,’LINE’,’LINE’,’LINE’)
DO I=1,6
CALL AXSPOS(350,NYA-(I-1)*350)
CALL POLCRV(CPOL(I))
CALL MARKER(0)
CALL GRAF(0.,20.,0.,5.,0.,10.,0.,5.)
NX=NXPOSN(1.)
NY=NYPOSN(8.)
CALL MESSAG(CPOL(I),NX,NY)
CALL CURVE(X,Y,16)
IF(I.EQ.6) THEN
CALL HEIGHT(50)
CALL TITLE
END IF
CALL ENDGRF
END DO
CALL DISFIN
END
276
Figure B.5: Interpolation Methods
277
C.6 Line Styles
PROGRAM EXA_6
C USE DISLIN for Fortran 90!
DIMENSION X(2),Y(2)
CHARACTER*6 CTYP(8)
DATA X/3.,9./CTYP/’SOLID’,’DOT’,’DASH’,’CHNDSH’,
* ’CHNDOT’,’DASHM’,’DOTL’,’DASHL’/
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL CENTER
CALL CHNCRV(’LINE’)
CALL NAME(’X-axis’,’X’)
CALL NAME(’Y-axis’,’Y’)
CALL GRAF(0.,10.,0.,2.,0.,10.,0.,2.)
CALL TITLE
DO I=1,8
Y(1)=9.5-I
Y(2)=9.5-I
NY=NYPOSN(Y(1))
NX=NXPOSN(1.0)
CALL MESSAG(CTYP(I),NX,NY-20)
CALL CURVE(X,Y,2)
END DO
CALL DISFIN
END
278
Figure B.6: Line Styles
279
C.7 Legends
PROGRAM EXA_7
C USE DISLIN for Fortran 90!
PARAMETER(N=301)
DIMENSION XRAY(N),Y1RAY(N),Y2RAY(N)
CHARACTER*14 CBUF
FPI=3.1415926/180.
STEP=360./(N-1)
DO I=1,N
XRAY(I)=(I-1)*STEP
X=XRAY(I)*FPI
Y1RAY(I)=SIN(X)
Y2RAY(I)=COS(X)
END DO
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL AXSPOS(450,1800)
CALL AXSLEN(2200,1200)
CALL NAME(’X-axis’,’X’)
CALL NAME(’Y-axis’,’Y’)
CALL TITLIN(’Demonstration of CURVE’,1)
CALL TITLIN(’Legend’,3)
CALL LABDIG(-1,’X’)
CALL TICKS(10,’XY’)
CALL GRAF(0.,360.,0.,90.,-1.,1.,-1.,0.5)
CALL TITLE
CALL XAXGIT
CALL CHNCRV(’LINE’)
CALL CURVE(XRAY,Y1RAY,N)
CALL CURVE(XRAY,Y2RAY,N)
CALL DISFIN
END
280
Demonstration of CURVE
Legend
1.0
Legend
0.5 sin (x)
cos (x)
281
0.0
-1.0
0 90 180 270 360
X-axis
C.8 Shading Patterns (AREAF)
PROGRAM EXA_8
C USE DISLIN for Fortran 90!
DIMENSION IXP(4),IYP(4),IX(4),IY(4)
CHARACTER*60 CTIT,CSTR*2
DATA IX/0,300,300,0/IY/0,0,400,400/
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL HEIGHT(50)
NL=NLMESS(CTIT)
NX=(2970-NL)/2
CALL MESSAG(CTIT,NX,200)
NX0=335
NY0=350
DO I=1,3
NY=NY0+(I-1)*600
DO J=1,6
NX=NX0+(J-1)*400
II=(I-1)*6+J-1
CALL SHDPAT(II)
WRITE(CSTR,’(I2)’) II
DO K=1,4
IXP(K)=IX(K)+NX
IYP(K)=IY(K)+NY
END DO
CALL AREAF(IXP,IYP,4)
NL=NLMESS(CSTR)
NX=NX+(300-NL)/2
CALL MESSAG(CSTR,NX,NY+460)
END DO
END DO
CALL DISFIN
END
282
Figure B.8: Shading Patterns
283
C.9 Vectors
PROGRAM EXA_8
C USE DISLIN for Fortran 90!
DIMENSION IVEC(20)
CHARACTER*60 CTIT,CNUM*4
DATA IVEC/0,1111,1311,1421,1531,1701,1911,
* 3111,3311,3421,3531,3703,4221,4302,
* 4413,4522,4701,5312,5502,5703/
CTIT=’Vectors’
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL HEIGHT(60)
NL=NLMESS(CTIT)
NX=(2970-NL)/2
CALL MESSAG(CTIT,NX,200)
CALL HEIGHT(50)
NX=300
NY=400
DO I=1,20
IF(I.EQ.11) THEN
NX=NX+2970/2
NY=400
END IF
WRITE(CNUM,’(I4)’) IVEC(I)
NL=NLMESS(CNUM)
CALL MESSAG(CNUM,NX-NL,NY-25 )
CALL VECTOR(NX+100,NY,NX+1000,NY,IVEC(I))
NY=NY+160
END DO
CALL DISFIN
END
284
Vectors
0 3531
1111 3703
1311 4221
1421 4302
1531 4413
285
1701 4522
PROGRAM EXA_10
C USE DISLIN for Fortran 90!
DIMENSION XRAY(18)
CHARACTER*60 CTIT,CBUF*36,CSTR*2
DATA XRAY/18*1./
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL AXSPOS(250,2700)
CALL AXSLEN(1600,2200)
CALL TITLIN(CTIT,3)
CALL HEIGHT(50)
CALL LEGINI(CBUF,18,2)
DO I=1,18
WRITE(CSTR,’(I2)’) I-1
CALL LEGLIN(CBUF,CSTR,I)
END DO
CALL LABELS(’NONE’,’PIE’)
CALL PIEGRF(CBUF,1,XRAY,18)
CALL TITLE
CALL DISFIN
END
286
Figure B.10: Shading Patterns
287
C.11 3-D Bar Graph / 3-D Pie Chart
PROGRAM EXA_11
C USE DISLIN for Fortran 90!
CHARACTER*80 CBUF
REAL XRAY(5),Y1RAY(5),Y2RAY(5)
INTEGER IC1RAY(5),IC2RAY(5)
DATA XRAY/2.,4.,6.,8.,10./,Y1RAY/0.,0.,0.,0.,0./,
* Y2RAY/3.2,1.5,2.0,1.0,3.0/
DATA IC1RAY/50,150,100,200,175/,
* IC2RAY/50,150,100,200,175/
CALL METAFL(’POST’)
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL HWFONT
CALL SHDPAT(16)
CALL AXSLEN(1500,1000)
CALL AXSPOS(300,1400)
CALL BARWTH(0.5)
CALL BARTYP(’3DVERT’)
CALL LABELS(’SECOND’,’BARS’)
CALL LABPOS(’OUTSIDE’,’BARS’)
CALL LABCLR(255,’BARS’)
CALL GRAF(0.,12.,0.,2.,0.,5.,0.,1.)
CALL TITLE
CALL COLOR(’RED’)
CALL BARS(XRAY,Y1RAY,Y2RAY,5)
CALL ENDGRF
CALL SHDPAT(16)
CALL LABELS(’DATA’,’PIE’)
CALL LABCLR(255,’PIE’)
CALL CHNPIE(’NONE’)
CALL PIECLR(IC1RAY,IC2RAY,5)
CALL PIETYP(’3D’)
CALL AXSPOS(300,2700)
CALL PIEGRF(CBUF,0,Y2RAY,5)
CALL DISFIN
END
288
3-D Bar Graph / 3-D Pie Chart
5.0
4.0 3.2
3.0
3.0
2.0
1.5
2.0
1.0
1.0
0.0
0.0 2.0 4.0 6.0 8.0 10.0 12.0
1.5
2.0
3.2
1.0
3.0
289
C.12 Surface Plot (SURFUN)
PROGRAM EXA_12
C USE DISLIN for Fortran 90!
CHARACTER*60 CTIT1,CTIT2
EXTERNAL ZFUN
CALL SETPAG(’DA4P’)
CALL DISINI
CALL PAGERA
CALL COMPLX
CALL AXSPOS(200,2600)
CALL AXSLEN(1800,1800)
CALL NAME(’X-axis’,’X’)
CALL NAME(’Y-axis’,’Y’)
CALL NAME(’Z-axis’,’Z’)
CALL TITLIN(CTIT1,2)
CALL TITLIN(CTIT2,4)
CALL VIEW3D(-5.,-5.,4.,’ABS’)
CALL GRAF3D(0.,360.,0.,90.,0.,360.,0.,90.,
* -3.,3.,-3.,1.)
CALL HEIGHT(50)
CALL TITLE
CALL SURFUN(ZFUN,1,10.,1,10.)
CALL DISFIN
END
FUNCTION ZFUN(X,Y)
FPI=3.14159/180.
ZFUN=2*SIN(X*FPI)*SIN(Y*FPI)
END
290
Figure B.12: Surface Plot
291
C.13 Map Plot
PROGRAM EXA_13
C USE DISLIN for Fortran 90!
DIMENSION XC(9),YC(9)
CHARACTER*12 CSTR(9)
DATA XC/-22.,18.,37.5,0.,2.5,12.5,23.5,-3.75,14.25/
* YC/64.,59.6,56.,51.5,48.5,42.,38.,40.3,50.1/
* CSTR/’Reykjavik’,’Stockholm’,’Moskau’,’London’,
* ’Paris’,’Rom’,’Athen’,’Madrid’,’Prag’/
CALL METAFL(’POST’)
CALL DISINI
CALL PAGERA
CALL HWFONT
CALL AXSPOS(500,1850)
CALL AXSLEN(2200,1400)
CALL LABDIG(-1,’xy’)
CALL TICKS(1,’xy’)
CALL NAME(’Longitude’,’x’)
CALL NAME(’Latitude’,’y’)
CALL LABELS(’MAP’,’xy’)
CALL PROJCT(’LAMBERT’)
CALL FRAME(3)
CALL GRAFMP(-40.,60.,-40.,20.,35.,70.,40.,10.)
CALL WORLD
CALL CURVMP(XC,YC,9)
DO I=1,9
CALL POS2PT(XC(I),YC(I),XP,YP)
NXP=XP+30
NYP=YP
CALL MESSAG(CSTR(I),NXP,NYP)
END DO
CALL GRIDMP(1,1)
CALL HEIGHT(50)
CALL TITLE
CALL DISFIN
END
292
Map Plot
Reykjavik
50o N Stockholm
Moskau
293
London
Latitude
Prag
Rom
Madrid
Athen
Index
This appendix presents all routines in the graphics library in alphabetical order. For parameters, the
following conventions are used:
295
Routine Parameter Level Page
296
Routine Parameter Level Page
297
Routine Parameter Level Page
298
Routine Parameter Level Page
299
Routine Parameter Level Page
300
Routine Parameter Level Page
301
Routine Parameter Level Page
302
Routine Parameter Level Page
303
Routine Parameter Level Page
304
Routine Parameter Level Page
305
Routine Parameter Level Page
306
Routine Parameter Level Page
307
Routine Parameter Level Page
308
Routine Parameter Level Page
309
310