Giter Site home page Giter Site logo

guff's Introduction

guff: a plot device

guff reads a stream of points from a file / stdin and plots them.

guff is short for MacGuffin.

guff is distributed under the ISC License.

Plots them?

It can plot to stdout:

$ wc -l *.c | grep -v total | sort -nr | awk '{print($1)}' | ./guff -d 72x30
    x: [0 - 15]    y: [0 - 302] -- 0: #
+                                                                       
#                                                                       
|                                                                       
|                                                                       
|                                                                       
+                                                                       
|    #                                                                  
|                                                                       
|        #                                                              
|                                                                       
+             #                                                         
|                  #                                                    
|                      #                                                
|                           #                                           
|                                                                       
+                                #                                      
|                                                                       
|                                    #                                  
|                                                                       
|                                                                       
+                                                                       
|                                                                       
|                                         #    #                        
|                                                  #                    
|                                                       #               
+                                                                       
|                                                            #          
|                                                                       
|                                                                #    # 
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+-


$ ./guff -d 40x20 -m count test_sin
    x: [0 - 720]    y: [-1 - 1]
+                                       
|                          ijjh         
|                        9j1  2j8       
|                       ba      ba      
|                      98        98     
+                     6a          b5    
|                    1d            e    
|                    e              e   
|                   94              58  
|                  2a                a2 
6----+----+----+---d+----+----+----+--8-
49                94                    
|a3              49                     
| e              e                      
| 2c            d1                      
+  78          96                       
|   b6        7a                        
|    d7      8c                         
|     cg    hb                          
|      3jjjj2                           

Or to SVG:

$  wc -l *.c | grep -v total | sort -nr | awk '{print($1)}' | ./guff -s -m line -r > example.svg

cat <<EOF | ./guff -s -x -m count
1 1
1 2
-2 -3
3 -4
-2 -3
2 4
3 -4
1 2
3 5
-2 -3

Input format

guff reads a stream of lines of floating point numbers, separated by a single character:

1 2.0 3

and

1,2,3

both read as 1.0, 2.0, 3.0.

If multiple separators appear, then the value is treated as missing for that column's row:

1,,3

reads as 1.0, [missing value], 3.0.

Any line beginning with "/" or "#" is ignored, and anything else that strtod(3) considers an ill-formatted number (e.g. "-") will lead to the rest of the line being skipped.

Blank lines

Blank lines make guff plot and reset. For example, guff can be used to convert an infinite stream of data periodically broken up by blank lines into an infinite stream of SVG plots, also broken up by blank lines. (The included script, discretion, splits these into timestamped SVG files and updates a symlink to the newest.)

Why write another plotter?

Not everything has graphic libraries installed (or a graphic environment at all), and sometimes it's helpful to get a rough feel for data's distribution from a text-mode command line. SVG images can also be generated pretty easily.

Installation

guff depends on on nothing besides a standard POSIX environment.

To build it, type make.

To run the tests, type make test.

Usage

Usage: guff [-A] [-c] [-d WxH] [-f] [-h] [-l xyc]
            [-m MODE] [-r] [-s] [-S] [-x] [FILE]

Common options:

-d WxH: set width and height (e.g. "-d 72x40", "-d 640x480")
-f: flip x & y axes in plot
-h: print help message
-l LOG: any of 'x', 'y', 'c' -- set X, Y, and/or count to log scale
-m MODE: dot, count, line (SVG only), default dot
-s: render to SVG
-x: treat first column as X for all following Y columns (def: use row count)

SVG only:

-c: use colorblind-safe default colors
-r: draw linear regression lines

Other options (mostly for internal testing):

-A: don't draw axes
-S: disable stream mode

For more details, see the man page.

guff's People

Contributors

katef avatar silentbicycle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

09981152473

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.