DISLIN - a high-level library for visualizing user data

    dislin logo
    I think everyone is faced with the problem of data visualization inside their program. Especially if the program is console. In the topic, I want to talk about the free (for non-commercial use) cross-platform library DISLIN , which was developed by the M. Planck Institute for Solar System Research (Germany). DISLIN can both simply display graphs and immediately save them to files. The developers declare the possibility of using fortran, c / c ++, Perl, Python, Java, .NET.
    The library supports the following display types: VGA, X Windows, Windows API, OpenGL and Tektronix ; and the following file formats are GKSLIN, CGM, HPGL, PostScript, PDF, WMF, SVG, PNG, BMP, GIF, TIFF. At the same time, import of images into TeX is supported, which is good news.

    What can DISLIN do?
    • Construction of two- and three-dimensional graphs and surfaces.
    • Construction of curves, including those defined parametrically.
    • Elementary operations of constructing lines, vectors, fields and geometric shapes with various types of fill.
    • Work with text: legend, signatures, etc.
    • Construction of two- and three-dimensional histograms and diagrams.
    • Building maps (regular and contour) in various projections.
    • Create your own GUI.
    How to use?

    I'll show you an example of c #. To include DISLIN in your project you need:
    • Add the disnet.dll file to the “References”. All library calls are collected in the dislin class.
    • Add the dislin.cs file to the project.
    • Put the dislnc.dll library in the project folder.
    Let's try to build a projection of a three-dimensional graph onto a plane:
       // Определили формат вывода графика: xwin - вывод на экран
       dislin.metafl ("xwin");

       // Инициализировали библиотеку DISLIN
       dislin.disini ();

       // Определим заголовок
       dislin.titlin ("3-D Colour Plot of the Function", 1);
       dislin.titlin ("f(x,y) = sin(x) * cos(y)", 3);

       // Подписи осей
       dislin.name ("X-axis", "X");
       dislin.name ("Y-axis", "Y");
       dislin.name ("Z-axis", "Z");

       // Вывели заголовок
       dislin.title ();

       // Задали размеры осей
       dislin.ax3len(1000, 1000, 1000);

       // Строим систему координат
       dislin.graf3(0.0f, 360.0f, 0.0f, 90.0f, 0.0f, 360.0f, 0.0f, 90.0f, -2.0f, 2.0f, -2.0f, 1.0f);

       // Выводим график. В массиве func хранятся предвычисленные значения функции
       dislin.crvmat(func, n, n, 1, 1);

       // Завершили работу с DISLIN
       dislin.disfin ();

    * This source code was highlighted with Source Code Highlighter.
    And here’s what happened:
    Projection of a surface onto a plane

    Now let's build a regular two-dimensional graph:
      dislin.titlin("CURVE", 1);
      dislin.titlin("SIN^2(X), SIN(X) + COS(X)", 3);

      dislin.graf(0.0f, 360.0f, 0.0f, 90.0f, -2.0f, 2.0f, -1.0f, 0.5f);

       //Построим 2 кривые
      dislin.curve(xPoints, func1, n);
      dislin.curve(xPoints, func2, n);

    * This source code was highlighted with Source Code Highlighter.

    Graph in polar coordinates:
      dislin.polar(1.0f, 0.0f, 0.2f, 0.0f, 30.0f);
      dislin.curve(xPoint, func, n);
    * This source code was highlighted with Source Code Highlighter.
    Polar coordinates

    And finally, a three-dimensional surface:
       dislin.view3d (-5.0f, -5.0f, 4.0f, "ABS");
       dislin.graf3d (0.0f, 360.0f, 0.0f, 90.0f, 0.0f, 360.0f, 0.0f, 90.0f,
        -3.0f, 3.0f, -3.0f, 1.0f);

       dislin.color ("red");
       //Задаем поверхность
       dislin.surmat (func, n, m, 1, 1);

    * This source code was highlighted with Source Code Highlighter.


    To immediately save the chart to a file, you need to set the desired extension in the metafl function, for example:
       dislin.metafl ("png");
    The dislin.png file with a picture will appear in the program folder.

    Cons of the library:
    • The figure turns out static: you cannot rotate a three-dimensional surface or change the scale. Although the projection options are configurable.
    • There is no support for the Russian language. I have to make signatures in English.
    What else to read?

    Many examples are given on the official website of the library: www.mps.mpg.de/dislin/examples.html
    You can also see the user gallery .
    Presentation from the developers (English): www.mps.mpg.de/dislin/dislin.ppt
    Online manual (English): www.mps.mpg.de/dislin/manual.html
    Quick reference to the functions (English): www.mps.mpg.de/dislin/appa.html
    Download link (v. 10.1) : www.mps.mpg.de/dislin/downloads.html

    By the way, the DISLIN library is already 25 years old. The first version was published in December 1986.

    Also popular now: