X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f996b,8ae611e029f9880b,start X-Google-Attributes: gidf996b,public X-Google-ArrivalTime: 2002-11-13 16:22:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!ae5b9.pppool.DE!not-for-mail From: Josef 'Jupp' Schugt Newsgroups: alt.ascii-art Subject: ASCII-Art function plotting, advice needed... Date: Wed, 13 Nov 2002 20:47:33 +0000 Organization: none Lines: 59 Message-ID: NNTP-Posting-Host: ae5b9.pppool.de (213.6.229.185) X-Trace: fu-berlin.de 1037233334 14291284 213.6.229.185 (16 [53633]) X-Orig-Path: jupp.8m.com!news User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com alt.ascii-art:20645 Hi! I hope my question is on-topic and not too scientific. I want to write a tiny ASCII-Art function plotter that outputs graphics like the following (this sample has been done manually, it's just a proof of concept and the result of fiddling with different characters for the function plot): > sin(x) for x ranging from -3 to 3 > ______________________________________________________________ 1 > | | _-"""""-_ | > | | _" -_ | > | | _" - | > | | - "_ | > | | - _ |_ > | | - - | > | | " - | > | | " -| > | |_" - > |___________________________________________________________|__ 0 > | _| | > - _ | | > |- _ | | > | - _ | | > | " _ | | > | " - | |_ > | "_ - | | > | - _" | | > | "_ _- | | > |_________"-_____-"___________|_____________________________|__ -1 > | ' | ' | ' | ' | ' | ' | > -3 -2 -1 0 1 2 3 The idea of achieving a good vertical resolution is mapping [0.000, 0.025) to '_', [0.025, 0.075) to '-', [0.075, 0.100) to '"'. (left boundary included, right one excluded that is) - note that the above plot may slightly differ from this mapping; it was done manually and to err is human. Anybody has a better mapping? Forget about '^' or similar characters that look very different in different fonts - I can't control the font that is used. The ideal mapping would take into account not only the value at a given point but also the left and right neighbor (which is an approximation for the slope). The output is meant to be generated automatically so I need fixed mapping rules. Anybody can provide such rules? Before I forget it: The output is meant to fit 80x24 (actually 79x24 that is); note that I didn't use full width because there has to be some space left for numbers with more digits. You wonder what this plotter is good for? The idea is to make a server output status diagrams even if there is no 'real' graphics available. Josef 'Jupp' Schugt