[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How can I draw ascii catesian diagram?



On Tue, Dec 12, 2006 at 12:49:16AM +0100, Andrea Ganduglia wrote:
> Hi. I have small script that supply me few data and I want draw a small
> cartesian diagram, but directly into script output, without gnuplot or
> similar. Same as:
> 
> 5|                   .
> 4|        ...       . .
> 3|    . .    ....  .   .
> 2|  .            .      .
> 1|..                      ..
> 0|-------------------------------
> 
> Do you know some perl/bash/awk script that can help me?

We don't have enough information.  As far as perl/bash/awk, I suggest
that you do it from within the script that is providing the data (unless
you want something generic, in which case you're rewriting gnuplot).  If
the language used for your script can't do it, get a better language.

I suggest that you consider the grid for your diagram including the axis
as a 2-dimension array.  Then have the script add the axis, then cycle
through the data and add the data points.  When that's done, read the
array line by line and print it out.

For reference on how to do this, you'r best souce is probably, beleive
it or not, a Fortran book since its very common to have to print summary
data such as this in straight print-out.  Your local library can
probably get a book or go to your nearest university engineering
library.  Every engineer has to learn Fortran so all the basic how-texts
for them would include such routines that you could adapt to your
language.

Personlly, for any script more complicated than a dos .bat file, I use
Python.  If its too big or takes too long to run, I translate it to
Fortran77 from there.  My guess is that Python will do what you want
very easily.

Doug.

 



Reply to: