tags:

views:

84

answers:

3

Hi, it would be interesting to be able to plot a 2D graph within an Ada code rather than having to save values say to file and use an external drawing software afterwards. A search on the web has taken me to two packages: Win_IO and JEWL. I have been able to use WIN_IO though but the documentation is quite poor and having just started using it, it seems that it is not possible to resize the size of the canvas. I use the GPS editor and I get complaint when running Win_IO that some fonts are not available on my system and that the output will be ugly. Finally the plot doesn't itself pop up on the screen; One has to click on the exe file of the file being compiled and linked so as to get the graph.

I have taken a look also at JEWL but it doesn't seem to be able to plot graphs.

Are there more Ada packages available out there for plotting 2D graphs.

Thanks a lot...


My experience with GNAVI:

The installation instructions are at

http://www.gnavi.org/index.php?Command=Class&ClassID=Start&CID=381

Basically the installation consists of: To use:

  1. Place this directory on your path
  2. cd to gnatcom and run: make install
  3. cd to gwindows and run: make UNICODE=1 all
  4. run: gnavi_ide and enjoy :-)

But the installation is plagued with errors:

C:\gnavi\gnatcom>install Installing GNATCOM..... MAKE Version 5.2 Copyright (c) 1987, 2000 Borland Error makefile 2: Command syntax error * 1 errors during make * Install Completed

C:\gnavi\gwindows>make UNICODE=1 all MAKE Version 5.2 Copyright (c) 1987, 2000 Borland Error makefile 2: Command syntax error * 1 errors during make *

And though C:GNAVI is on my path, the IDE still complains that icg.exe which is found in C:GNAVI is not on the path.`This is trouble with software which has not been fully tested!!! I was very disappointed that people can write irresponsible and incomplete installation instructions. Have the developers even found out that whether a normal user can install their software?

I have also try to look at AdaDesigner at https://gna.org/projects/adadesigner

Here, FireFox complains: This Connection is Untrusted

gna.org uses an invalid security certificate.

The certificate is not trusted because the issuer certificate is unknown.

I decided not to visit such a website.

+2  A: 

I'd give a try to GTKAda. I'm not completely sure this subsystem would allow you to do 2D graphs as I've never used it for that purpose, but it can be done with GTK+ (C/C++).

There is also a guide on GTKAda and a reference manual, some documentation on the GTK toolkit itself may also come handy.

Xandy
Thanks. For Win_IO (http://www.ctr.unican.es/Win_IO/) to work, GTKAda must be installed. I did that yesterday and could make Win_IO to work. It was easy to add the necessary folders and link to a project file within GTKAda using the GPS editor. However, I'm not satisfied with Win_IO. One can plot only very short sequence of data. I don't know if I have the ability to use GTKAda directly.
yCalleecharan
You can certianly draw lines and points with GTK. Kinda like swatting a fly with a sledgehammer, but it will do the job.
T.E.D.
Thanks. Please see my comments down under your answer on what I would really like to do.
yCalleecharan
+2  A: 

It depends on exactly what you want to do. For graphing node-based diagrams, the first thing I'd look into using is Graphviz. It has its own special graphing language it uses, but I'm all about using Domain Specific Languages when appropriate. Ada has great interoperability, so using DSLs with it can really make it powerful.

An example I found is AdaDesigner, which generates Graphviz DOT files to help visualze the structure of Ada code.

The one time in the past I had to do simple plotting, it was for a web app. I ended up dynamically generating SVG pages on the server side (even though it was poorly supported then). Support is better now, so I'd definitely use it again today.

If working directly on a Windows PC display appeals more to you, there are several options for GUI bindings, all of which should support drawing lines and points on a canvas. In addtion to GTK (which is both powerful and portable), there are a few Win32 API's floating around. I think one comes with Gnat. Another you might not be aware of is GWindows. It is part of GNAVI, which aims to be sort of an OpenSource alternative to Delphi. It isn't the most active of projects, but is (reportedly) quite useable, and is still being worked on and used. Here are some screenshots of it being used for plotting. alt text

T.E.D.
Thanks. I had problems with the installation on GNAVI. See bottom information of my post.
yCalleecharan
Also problems to reach AdaDesigner
yCalleecharan
I would like to be able to plot 2D graphs (Y versus X values) from Ada itself without having recourse to save to files and using an external plotting program like Matlab, gnuplot, etc...
yCalleecharan
1 vote up for trying to find alternatives.
yCalleecharan
+2  A: 

PLplot is a cross-platform package for creating scientific plots. It has a well-documented Ada binding.

Addendum: For reference, these Ada examples correspond to these images, by number.

trashgod
Sadly, I have yet to use it.
trashgod
Thanks. I've taken a look at PLplot. This one seems to be well suited for scientific plotting and the good thing is that it comes with a good manual. I haven't yet installed it but I'll do it.
yCalleecharan
I created a new post here: http://stackoverflow.com/questions/3218154/ada-and-plplot-installation .
yCalleecharan
PLplot seems very nice at first glance. 1 vote up
yCalleecharan