These awful graphic problems are immortal...

Glynn Clements comments my suggestion about using PostScript as
the output interface
Well, more than often proposing another *language* to process raw data
might be an overkill.
    

I wasn't proposing *processing* the data in PostScript.
  
Well, if you think about writing a PostScript program, containing
- instead of raw data, say 10, 25, 65, the commands
0 10 moveto 1 10 lineto 2 25 lineto, etc., with stroking, filling, curveto's,
scaling - as proposes Sergey Zaharchenko, then you *do* write a data
processing program in Postscript.
  Where the output goes, it is another story.
  Sergey gives some simple-minded examples, quite OK. But I challenge
him or you to tell *to a newbie* how to perform the automatic scaling of
the plot axes. And how to make an EPS document embeddable in another
one with all those bounding boxes (which depend on the chosen scale, etc.)
How to make legends. And histogram fills with patterns.  No, don't tell me
this is something self-evident.  I know Postscript.

Well, there are lots of ways in which you could draw stuff from
Haskell.

One is to use an in-process graphics library (e.g. GLUT/OpenGL,
wxHaskell, GTK+HS). However, if your Haskell environment doesn't
already include these, it could be highly non-trivial to actually get
to the point where you can use them.

Another is to use the core I/O functions (e.g. writeFile) to generate
files for an external program.

Either approach requires that you learn (or already know) the details
of a graphics library or file format. If you don't already know one, I
don't feel that PostScript would necessarily be any more involved than
e.g. OpenGL or GDK. You don't really have to understand the *language*
as such; there's no reason why you can't treat it as simply data, i.e. 
just write lots of 'show x ++ " " ++ show y ++ " lineto\n"'.
  
You don't need any special file format to prepare data for Matlab.
Use free format, fscanf it into a matrix, and then call hist or whatever.
The advantage is that all scaling, smoothing, annotating, filling etc.
is there, at your disposal. Just imagine the amount of extra text
which would have to be output by a Haskell program...

The alternative, if there is no Matlab by hand, is Scilab, Gnuplot, etc.
Also here, output data only, and let the formatting to be done by the
specialized package.

It would be a very good idea to prepare a comprehensive library of
high-level Postscript codes, permitting to a Haskell programmer to
output a well-tuned, colourful plot, with axes, etc. fast. A step in that
direction has been made quite a time ago, the diploma thesis of
Joachim Korittky: "Functional MetaPost"; see, e.g. the pages of Ralf
Hinze, some doc by Marco Kuhlmann, and some work of  Feri Wagner
and (doc) Meik Hellmund.  If you manage to find that stuff, the 'revival'
of the system was rather chaotic...
It is still not *very* high level, and for the moment it seems less
appropriate for serious plots than piping raw data to Matlab or similar.
But to draw diagrams or simplistic curves, why not?

Jerzy Karczmarczuk
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to