(way OT) Re: [Haskell] Re: 2-D Plots, graphical representation of massive data

Sergey Zaharchenko doublef at tele-kom.ru
Sat Aug 28 01:51:26 EDT 2004


On Sat, Aug 28, 2004 at 02:01:40AM +0200,
 karczma probably wrote:
> Glynn Clements proposes to: 
> 
> >Zabiyaka, Yuliya
> who wants
> ...
> >>2) display result of the analysis (pie charts, histograms, plots) 
> >
> >If you don't need to interact with the display, the simplest solution
> >is to generate graphics files. Personally, I would use PostScript, as
> >I'm reasonably familiar with it and the Ghostscript interpreter is
> >freely available.
> 
> Well, more than often proposing another *language* to process raw data
> might be an overkill. I wouldn't dare to suggest that somebody learns
> PostScript just for that.

Postscript is not that horrible.

> I think that the original idea - to generate raw textual data and read
> them by Matlab is the simplest one. Almost nothing to do from the Haskell
> side, just to output a file, in free format.

<horrible `postscript for newbies' starts>

Postscript output for simple (w/o axes, numbers and such) graphs is also
simple. Suppose that you have the stages numbered and the times
calculated. In a raw text, you would print, say, (without the "> ")

> 0 10
> 1 20
> 2 11
> 3 23

where the first number is x and the second y.

In a Postscript file, you would write

> 0 100 moveto
> 100 200 lineto
> 200 110 lineto
> 300 230 lineto
> stroke
> showpage

(I just multiplied the numbers by 100 and 10 to suit the A4 paper size a
little better). This would get you a zigzag in the lower-left corner. It
helps to read `0 100 moveto' like `moveto 0 100' if you want to
understand something.

Another option is to do this:

> 0 100 moveto 10 200 lineto stroke
> 10 200 moveto 20 110 lineto stroke
> 20 110 moveto 30 230 lineto stroke
> showpage

(stroke is called for every segment of the zigzag).

The size of the `screen' is about 500x700, with an origin of (0,0) in
the lower-left corner (cartesian coordinates, y is up).

Actually, this is not quite valid Postscript (no EOF, etc) but
Ghostscript will grok it.

<horrible `postscript for newbies' ends>

The benefit (at least for me) of this is, that when you have a large
plot, each point of which is calculated for a reasonable time, you can
pipe the output of your program to Ghostscript ("prog | gs") and see it
displayed `in real time', just as output. This really helps if you are
tuning something and don't want to wait for the whole plot to display
and only want the first few results. YMMV.

Certainly, full-featured pie charts require a bit more understanding of
Postscript, so if you want them fast, it would be easier to go with
Matlab or whatever.

HTH,

-- 
DoubleF
Keep Cool, but Don't Freeze
		- Hellman's Mayonnaise
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell/attachments/20040828/18b92c89/attachment.bin


More information about the Haskell mailing list