Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-07

ASCII plotting

4 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alan Mead

I would like to include some simple "ascii plots" in my textual output files, like :

10.0| **
| * *
| * *
|* *
|* *
* *
* *
* *
* *
* *
* *
0.00|-----------*-*-
-3.5 3.50

I've coded something simple ... three times now... and I now realize how complex this can get. Lot's of isues with changing scales, optimizing the ouptut for very granular rows and columns, syncing the plot with the labels, choosing "good" labels, etc. For example, I found that I need to draw a "line" between the points otherwise the vertical line segments get lost:

10.0| **
| * *
|
|* *
|
| *
| *
| *
| *
|
* *
0.00|-----------*-*-
-3.5 3.50

But now I find that if I choose too many X values then the line segment drawing tends to make the make the drawing "fat", especially at the tails:

10.0| **
| * *
| * *
|* *
|* *
|* *
|* *
|* *
** *
** **
** ***
0.00|-----------***-
-3.5 3.50

Because I'm plotting discrete functions, changing the number of X values requires a complicated interpolation procedure...

So, does anyone, by chance, already have a unit for doing this?

-Alan Mead

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com

Reply by email

Johann Glaser
to Alan Mead

Hi!

I would like to include some simple "ascii plots" in my textual output files, like :

I'm sorry that I can't give you a unit. But look at "Maple" (http://www.maplesoft.com/). For Linux I've got an X interface (xmaple) and a text interface (maple).

The text interface does drawing plots as text. It even can draw 3D plots in text mode! Probably you have the chance to examine this program. Then try these feeatures!

Bye
Hansi

Johann Glaser Vienna University of Technology Electrical Engineering ____ http://www.johann-glaser.at/ ____

Reply by email

Unknown author
to Alan Mead: I would like to include some simple "ascii plots" in my textual output files, like :…
I would like to include some simple "ascii plots" in my textual output files, like :

There are some routines for ASCII plotting in this book: Press, W. H., Flannery, B. P., Teukolsky, S. A., & Vetterling, W. T. (1986).
Numerical recipes: The art of scientific computing. Cambridge, England: Cambridge University Press.
One version of the book has the source code in Pascal, and I'm sure it would work with FPC.

Jeff Miller

Reply by email

L D Blake
to Johann Glaser: Hi! I'm sorry that I can't give you a unit. But look at "Maple"…

In reply to your message of July 29, 2003

Show quoted text 10 lines
> I would like to include some simple "ascii plots" in my textual > output files, like : I'm sorry that I can't give you a unit. But look at "Maple" (http://www.maplesoft.com/). For Linux I've got an X interface (xmaple) and a text interface (maple). The text interface does drawing plots as text. It even can draw 3D plots in text mode! Probably you have the chance to examine this program. Then try these feeatures!

One thing I found helps with that "fatness" problem you got in a couple of spots is to confine your screen coordinates ... x,y : byte ... less chance of fractional or out of range returns causing the plotting decisions to wobble. (Text mode is decidedly low res, so use a low res numbering scheme to match <G>).

-----
L D Blake

Reply by email