DISLIN
A Scientific Plotting Package
(C examples)


DISLIN is a directory of C programs which illustrate the use of the DISLIN scientific plotting package.

The graphics output from DISLIN can go to into a standard graphics file, or an interactive X Window screen, or into a generic DISLIN graphics metafile, for later processsing. The standard graphics file formats that DISLIN recognizes include:

When creating a graphics output file, please note that DISLIN will not overwrite an existing graphics file. Instead, it will store the new information in a file with the right extension, but a different "first name" than you specified. For example, if you run the first example, it will create the file "dislin_ex01.png". If you rerun the first example, the output will go into a file which DISLIN arbitrarily names "dislin_1.png".

The csh shell scripts, below, give one way to compile, link and load a user program that calls DISLIN routines. However, as an overview, you should know that you will need to have access to the DISLIN include file, a copy of which can be gotten from this webpage, or from the directory

        /usr/local/dislin
      
and that you must link with the library libdislnc-8.3, but also with the X-Window libraries. One way to compile a program myprog.c might be
        gcc myprog.c /usr/local/dislin/lib/dislnc-8.3.a -L/usr/X11R6/lib -lXt -lXaw -lm
      

DISLIN Levels

DISLIN is a plotting library, designed so that you can be generating data and creating plots at the same time. This necessarily means that you use the program by making many subroutine calls, to define the plot type, the plot size, the axis length, and so on. The examples below are one way to familiarize yourself with this procedure, and the manual has extensive explanations of how to make the plot you want.

If might be helpful, though, to note one feature of DISLIN, (which it shares with related plotting libraries such as the old DISSPLA library). The plotting library starts out at "level 0". Calling an initialization routine moves you to "level 1", at which point graphs can be defined. Defining a graph moves you to level 2, at which point you can also define features associated with the graph, such as axes. When you read the manual, you will see that some plotting routines are only allowed to be called when the plotting library has reached a specific level.

Related Programs:

DISLIN examples are available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version.

Reference:

  1. Helmut Michels,
    User Manual for DISLIN version 8.4,
    a scientific data graphics package;
    dislin.pdf,
  2. http://www.mps.mpg.de/dislin/ The DISLIN web page;

Source Code:

Examples and Tests:

EX01 shows how to use the CURVE routine to plot sets of (X,Y) data:

EX02 shows how to use the POLAR routine to plot (R,Theta) data:

EX03 shows how the SYMBOL routine can be used to generate symbols:

EX04 shows how five different ways of plotting the same X, Y data, using different interpolation methods.

EX05 shows how three different ways of plotting the same X, Y data, using different bar graph formats.

EX06 shows how two different ways of labeling data that is displayed as a piechart.

EX07 shows how to make pie charts and bar graphs that have a 3D thickness to them.

EX07B shows how to make 3D bar graphs on a 3D range.

EX08 demonstrates available shading patterns.

EX09 demonstrates the use of color contour plots.

EX10 demonstrates the use of 3D surface (wiremesh) plots.

EX11 demonstrates the creation of a contour plot.

EX12 demonstrates the creation of a shaded contour plot.

EX13 demonstrates the creation of a map plot.

EX14 demonstrates the use of TeX instructions to define mathematical formulas.

You can go up one level to the C source codes.


Last revised on 03 September 2005.