Menu

Notes On Dislin (Plotting Utility)

Wayne Keen
2003-11-09
2012-09-26
  • Wayne Keen

    Wayne Keen - 2003-11-09

    A few questions have come up lately about easy graphics for Dev, and I have responded about my use of Dislin:

    http://www.linmpi.mpg.de/dislin/

    Now, for some reason, lost in the mists of illogic, I have mostly used dislin with Cygwin/gcc, not so much with Dev.  So I decided to do the exercise here at home of installing the MingW version of dislin, and do a simple example.

    I downloaded the installation program from here:

    http://www.linmpi.mpg.de/dislin/windows.html

    The one for:

    GCC, G77 MinGW/Mingw32

    The link is very slow by the way, and somewhat erratic.

    What you get is one zip file that contains the installation stuff.  I unzipped it to a temporary directory (c:\xfer\distemp in my case), and ran the setup program.  The setup program runs easily, and tells you after its through to put the dislin stuff in your path, and to create an environment variable DISLIN, and where to point it.  Pretty easy.  For weird reasons, I installed to c:\dislinm

    After installation, I went down into the dislin directory that was created by setup, and copied the file dislin.h into my c:\dev-cpp\include directory.

    Now, the preferred way for dislin to have you start is to use a batch file they made up called clink.bat to link your C programs.  I was a slave to this for too long, then I finally looked at it, and figured out what I needed to do.

    (1) In my project options, I went to parameters:add library or object and grabbed the dislin library file, which is in your dislin directory (the only something.a in c:\dislin, or wherever you installed to)

    (2) I also saw that the batch file was linking user32 and gdi32, so I added to the linker parameters

    -luser32 -lgdi32

    (3) I wrote my little console program.  Plots out a line:

    #include <stdio.h>
    #include <dislin.h>
    #include <math.h>

    int main()
    {
      float x[10];
      float y[10];
      int i,j;
      /*Generate stupid data to plot*/
      for (i = 0; i <= 10; i++)
      {
        x[i] = (float)i;
        y[i] = 2.0 * i + 3.14;
      }
     
      /*Do a connect the dots plot*/
      qplot(x,y,10);
     
    }

    Here is my compile log

    Compiler: Default compiler
    Building Makefile: "C:\mycstuff\Makefile.win"
    Finding dependencies for file: C:\mycstuff\mymain.c
    Executing  make...
    make.exe -f "C:\mycstuff\Makefile.win" all
    g++.exe -c mymain.c -o mymain.o -I"C:/Dev-Cpp/include/c++"  -I"C:/Dev-Cpp/include/c++/mingw32"  -I"C:/Dev-Cpp/include/c++/backward"  -I"C:/Dev-Cpp/include"    -g3 -O0

    g++.exe mymain.o  -o "projming.exe" -L"C:/Dev-Cpp/lib" ../dislinm/dismgc.a -luser32 -lgdi32 

    Execution terminated
    Compilation successful

    Wayne
    Running this gives me a nice straight line....woohoo  ;-)

    There are some funnies I have run into, when I do some 3D array surface plots on an array, call it z, in Cygwin I can write it this way:

    qplclr(z,nx,ny)

    but it won't compile under Dev/MingW unless I cahnge that to:

    qplclr(*z,nx,ny)

    Still looing at stuff like that...

     
    • Wayne Keen

      Wayne Keen - 2003-11-09

      For the sort of "plotting" type graphics I do, this is relatively easy.  If you check out the manual, you can do some GUI stuff as well, but I have NO experience in that area....

      Its pretty easy, once you sort out the linking stuff. (Which took me far too long, because I was in the thrall of clink.bat)

      Wayne

       
    • Jim W.

      Jim W. - 2003-11-09

      I took a look.  Might be a good candidate for a DevPack that the math-sci crowd would love.  I think it would take some careful -- and thoughtful -- "re-packaging" though...  Worth some discussion?

      Thanks for sharing your tips, Wayne!

      -- Jim.

       
    • Wayne Keen

      Wayne Keen - 2003-11-09

      As I mumbled, I am still learning how to use it with Dev, thought I have used it quite a bit from the command line with Cygwin, and a ton from Python.  (The cross usage is why I installed it to dislinm, and not dislin)

      It turns out you do not appear to need to set the DISLIN environment variable...

      Wayne

       
    • Jim W.

      Jim W. - 2003-11-10

      The package I got sets path and version in the registry, and seems to need it (even at runtime) for the default map stuff, at least.  Still messing with it, trying to remember to drop bread crumbs...

      -- Jim.

       
    • Wayne Keen

      Wayne Keen - 2003-11-11

      I did notice (feel free to have a good laugh at my expense here), that the version of dislin I was using on Cygwin was 7.6, on MingW, 8.1...

      I have not tested that out yet to see if it has anything to do with the differences I noted, but it does fit the description of a poorly controlled experiment....

      Wayne

       
    • Jim W.

      Jim W. - 2003-11-11

      Do you see a way to hook up dislin with gsl (preferably with mutual *MinGW* comptibility) and fairly up-to-date versions?  What I've got here doesn't "click", lib-wise (MinGW dislin, Cygwin gsl).

      Would seem to be a "cool" combination for a possible "SynthPack" (TM)....

      -- Jim.

       
    • Jim W.

      Jim W. - 2003-11-11

      PS -- In testing for C++ compatibility, with the map demo (in the 8.1 MinGW version), I had to rename the variable "xor".  Best clue was an error message about "^".  Of course....

      -- Jim.

       
    • Wayne Keen

      Wayne Keen - 2003-11-11

      "Do you see a way to hook up dislin with gsl "

      I have been writing on a program that uses both for work without any problems, but all I have used gsl for was some histogram stuff with dislin doing the plotting.

      Wayne

       
    • Jim W.

      Jim W. - 2003-11-11

      Hmmm...  Post a (simple) example/test program?  Thanks!

      -- Jim.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.